問題描述
我想點擊特定的電子郵件,在這種情況下我應該怎么做?我看到有一個具有多個索引的 Webtable,我選擇 1 &點擊它.有沒有人有代碼如何處理 WebDriver 中的 webTables?在下面的屏幕中查看確切的情況 -http://screencast.com/t/XRbXQVygNkN6
I hv to click on a particular email, in that case what should I do? I seen there is a Webtable with multiple indexes, I hv to select 1 & click on it. does anyone have code how to handle webTables in WebDriver? See exact situation in below screen- http://screencast.com/t/XRbXQVygNkN6
我正在嘗試使用以下代碼 - 請建議我完成其余操作.
I was trying with below code -Plz suggest me for rest of the action.
gmail登錄后-
第一次點擊收件箱鏈接--->>然后是促銷--->>然后我點擊特定的電子郵件
1st Ihv clicked on inbox link--->>then Promotions--->>then I hv to click on particular email
WebElement PromotionsSection =driver.findElement(By.xpath("http://div[contains(@id,':2y')]"));
PromotionsSection.click();
WebElement email=driver.findElement(By.xpath(".//*[@id=':1g4']/b"));
email.click();
推薦答案
認為你登錄后在頁面中.現(xiàn)在使用下面的代碼:
think that u r in page after login. Now use the below code:
List<WebElement> email = driver.findElements(By.cssSelector("div.xT>div.y6>span>b"));
for(WebElement emailsub : email){
if(emailsub.getText().equals("Your Subject Here") == true){
emailsub.click();
break;
}
}
如果它與主題字符串匹配,這只會點擊你的郵件.
this will just click on ur mail if it matches the subject string.
這篇關于如何從 Selenium 的 gmail 收件箱中單擊特定的電子郵件?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!