UI Automation encountered pit

1,ElementNotInteractableException: Message: element not interactable

The solution is to use xpath positioned, then js operating element, or the like clicks

service_ticket_list = self.get_element('service_ticket_list')
self.driver.execute_script("arguments[0].click();", service_ticket_list)

2, time.sleep problem

If another layer of code plus the time.sleep (5), tearDown method unitest also want to add time.sleep (5), otherwise there will be conflicts

3, taken failure code verification problem

Resolution of the computer system is set to 100% no problem

4, can not get the property value requires the use of .get_attribute ( "href") directly with XPATH

Preemptive element object, and then obtain the value get_attribute

xpath_urls = '//div[@class="qg-limit-list"]/a'
urls_pre = browser.find_elements_by_xpath(xpath_urls)
url = urls_pre[0].get_attribute("href")

5,unittest "ResourceWarning: unclosed <socket.socket fd=864, family=AddressFamily.AF_INET..." 解决办法

Import Represents warnings 
warnings.simplefilter ( " the ignore " , ResourceWarning) # add setup method

 

6,Element:ElementClickInterceptedException

方法一:

element = driver.find_element_by_css('div[class*="loadingWhiteBox"]')

driver.execute_script("arguments[0].click();", element)

方法二:

element = driver.find_element_by_css('div[class*="loadingWhiteBox"]')

webdriver.ActionChains(driver).move_to_element(element ).click(element ).perform()

 

7, 'AdminLoginCase' object has no attribute 'test_login_case'

Mouse cursor problems when running certain clicks the mouse over the bottom

Guess you like

Origin www.cnblogs.com/lvchengda/p/12627394.html