簡體   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