【发布时间】:2017-04-18 17:29:57
【问题描述】:
元素的HTML代码是:
<select id="pt1:reg2:1:soc1::content" class="x2h" title="" theme="dark" name="pt1:reg2:1:soc1">
每次 xpath 发生变化但我无法找到元素。
WebElement w1 = driver.findElement(By.xpath(".//select[starts-with(@id, 'pt1') AND contains(@id, ':soc1::content')]"));
Select s = new Select(w1);
s.selectByVisibleText("Commercial");
【问题讨论】:
-
使用编辑器上方的括号图标将代码与文本分开。
标签: selenium selenium-webdriver