Selenium webdriver 下拉组合框中不存在断言给定文本
我必须自动实现这样一个场景:我得到了我存储的名字和电子邮件地址,然后我需要用下拉框断言那个值,它不存在 这是我的网页的HTML代码Selenium webdriver 下拉组合框中不存在断言给定文本,selenium-webdriver,Selenium Webdriver,我必须自动实现这样一个场景:我得到了我存储的名字和电子邮件地址,然后我需要用下拉框断言那个值,它不存在 这是我的网页的HTML代码 <select id="Customer" name="Customer" class="valid"> <option value="raj777@gmail.com">123123123 (raj777@gmail.com)</option> </select> 提前感谢 遵循以下流程: 获取下拉列表中每个元素
<select id="Customer" name="Customer" class="valid">
<option value="raj777@gmail.com">123123123 (raj777@gmail.com)</option>
</select>
提前感谢 遵循以下流程:
driver.findElement(By.cssSelector(".trb_outfit_sponsorship_logo_img"))
.click();
System.out.println(dri.findElement(
By.cssSelector(".trb_outfit_sponsorship_logo_img")).getSize());
List<WebElement> dropDownValues = dri.findElements(By
.xpath("//select[@id='Customer']"));
ArrayList<String> dropDownValuesasText = null;
for (WebElement eachValue : dropDownValues) {
dropDownValuesasText.add(eachValue.getText());
}
// boolean result = dropDownValuesasText.contains("Your FirstName & Email value");
//It will pass if your value is present in drop down
assertNotEquals(dropDownValuesasText.contains("Your FirstName & Email value"), true);
driver.findElement(由.cssSelector(“.trb\u装备\u赞助\u标志\u img”))
。单击();
System.out.println(dri.findElement(
通过.cssSelector(“.trb_detage_赞助商_logo_img”)).getSize();
列表下拉值=dri.findElements(按
.xpath(“//选择[@id='Customer']”);
ArrayList dropDownValuesasText=null;
for(WebElement eachValue:dropDownValues){
dropdownValuesText.add(eachValue.getText());
}
//布尔结果=DropDownValuesText.contains(“您的名字和电子邮件值”);
//如果您的值出现在下拉列表中,则它将通过
assertNotEquals(dropDownValuesasText.contains(“您的名字和电子邮件值”),true);
driver.findElement(By.cssSelector(".trb_outfit_sponsorship_logo_img"))
.click();
System.out.println(dri.findElement(
By.cssSelector(".trb_outfit_sponsorship_logo_img")).getSize());
List<WebElement> dropDownValues = dri.findElements(By
.xpath("//select[@id='Customer']"));
ArrayList<String> dropDownValuesasText = null;
for (WebElement eachValue : dropDownValues) {
dropDownValuesasText.add(eachValue.getText());
}
// boolean result = dropDownValuesasText.contains("Your FirstName & Email value");
//It will pass if your value is present in drop down
assertNotEquals(dropDownValuesasText.contains("Your FirstName & Email value"), true);