验证混合型下拉框

This commit is contained in:
彭宇琦 2020-05-23 21:39:30 +08:00
parent 16492d5dfb
commit cf40291e9d
1 changed files with 20 additions and 0 deletions

View File

@ -2,6 +2,8 @@ package pres.auxiliary.work.selenium.element;
import java.io.File;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@ -80,5 +82,23 @@ public class SelectByTest {
s.add("//label[text()='缺陷来源']/../select");
//按照下标进行选择(第三个选项与需求不一致)
ce.click(s.getElement(3));
//点击修复版本未排期的第5个选项
ce.click(cby.getElement("//*[@id=\"fixVersions-multi-select\"]/span"));
s.add("//div[contains(@class, 'ajs-layer box')]//*[text()='20200408-解决实名制平台响应慢问题']/../..//a");
ce.click(s.getElement(5));
}
@Test
public void test() {
ce.click(cby.getElement("//*[@id=\"fixVersions-multi-select\"]/span"));
WebElement e = cb.getDriver().findElement(By.xpath("//div[contains(@class, 'ajs-layer box')]//*[text()='20200408-解决实名制平台响应慢问题']"));
System.out.println(e.getTagName());
cb.getDriver().findElements(By.xpath("//div[contains(@class, 'ajs-layer box')]//*[text()='20200408-解决实名制平台响应慢问题']/../..//a")).
stream().map(ele -> {
return ele.getText();
}).forEach(System.out :: println);
}
}