繁体   English   中英

Web元素查找问题

[英]Webelement finding issues

Web元素在下面提到的情况下发现问题

在网页https://pastebin.com/上 ,需要从“粘贴过期:”下拉列表中选择选项“ 10分钟”。

以下是已采取的步骤:

//Identification the Never option and clicking it the dropdown to show up
//This part of the code works
WebElement pasteExpiration = driver.findElement(By.xpath("//*[@class='form_frame_left']//*[@title = 'Never']"));
pasteExpiration.click();

//Selecting the'10 Minute' option, this code is not identified by the WebDriver
WebElement pasteExpiration10Minutes = driver.findElement(By.cssSelector("#select2-paste_expire_date-q4-container"));

WebDriver没有看到“ 10分钟”选项字段,我们试图编写自己的xpath,但没有任何效果。

请尝试以下行:

driver.findElement(By.xpath("//span[starts-with(@id,'select2-paste_expire_date')]")).click();
driver.findElement(By.xpath("//li[text()='10 Minutes']")).click();

它为我工作。 我已经在Chrome浏览器上检查过。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM