代码如图
wait = WebDriverWait(self.browser,20)
wait.until(EC.element_to_be_clickable((By.ID,'city')))
self.browser.find_element_by_xpath('//*[@id="city"]/li[2]').click()
log报的错误是找不到元素city,我查看了self.browser的sourcepage属性,是有id属性为city的元素的.
ringa_lee2017-04-17 17:26:32
Write a more specific xpath, for example: "/img[@src='images/sidebar/icon-nav-white-community.879b43c0.svg']"
PHP中文网2017-04-17 17:26:32
waitUntil occasionally has bugs, it is recommended to use js to trigger it