Eclipse xpath用于
下面HTML元素的xpath应该是什么。此元素在div标记中没有任何类定位器Eclipse xpath用于,eclipse,selenium,xpath,webdriver,Eclipse,Selenium,Xpath,Webdriver,下面HTML元素的xpath应该是什么。此元素在div标记中没有任何类定位器 <img src="/images/banner2.gif" width="488" height="63" border="0" hspace="8" vspace="4"> 只能使用class或id属性不是强制性的。您也可以使用其他属性来唯一标识元素。这里可以使用src属性 请尝试xpath: Java代码: 或 注意:将以下导入添加到您的解决方案中: from selenium.webdriver.
<img src="/images/banner2.gif" width="488" height="63" border="0" hspace="8" vspace="4">
只能使用class或id属性不是强制性的。您也可以使用其他属性来唯一标识元素。这里可以使用src属性 请尝试xpath: Java代码: 或 注意:将以下导入添加到您的解决方案中:
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
上述解决方案对我有效。。非常感谢你。
WebElement image = driver.findElement(By.xpath("//img[@src='/images/banner2.gif']"));
WebDriverWait(driver, 30).until(
EC.element_to_be_clickable((By.XPATH, "//*[@src='/images/banner2.gif']")))
WebDriverWait(driver, 30).until(
EC.element_to_be_clickable((By.CSS_SELECTOR, "img")))
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By