网站是:https://www.smile.one/merchant/mobilelegends?source=other
如果单击下图中的任何项目,您将在该选择上获得一个绿色勾号。请参见这两幅图
选择后:
我无法使用selenium执行此单击操作。
这就是我正在尝试的:
driver.get("https://www.smile.one/merchant/mobilelegends?source=other")
driver.find_element_by_xpath("//div[@class='sectionNav-cartao n107002' and @ga-data='1717']").click()
这引发了一个例外:
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.ElementNotVisibleException: Message: element not interactable
我还尝试使用inspect元素使用精确的直接路径:
WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "body > mate > div.main-container > section > div.section-nav > div.sectionNav-list > div.sectionNav-cartao.n107002"))).click()
并得到一个timeout
错误
我也试过其他几种方法,但似乎都不管用
如何执行此单击
如果要使用
XPath = "//div[@class='sectionNav-cartao n107002' and @ga-data='1717']"
,则有两个元素具有相同的XPath。使用像XPath = "//div[@class='pc-nav']//div[@class='sectionNav-cartao n107002' and @ga-data='1717']"
这样的唯一XPath,它在chrome开发工具中只突出显示一个元素代码:
相关问题 更多 >
编程相关推荐