简体   繁体   中英

Webelement finding issues

Webelement finding issues in the mentioned below case

On the webpage https://pastebin.com/ it is required to select the option '10 Minutes' from the dropdown 'Paste Expiration:'

Here are the taken steps:

//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 does not see '10 Minute'option field, we tried to write our own xpaths, nothing works.

Please try below lines:

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

It worked for me. I have checked on chrome browser.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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