How to click on a Particular email from gmail inbox in Selenium?(如何从 Selenium 的 gmail 收件箱中单击特定的电子邮件?)
问题描述
我想点击特定的电子邮件,在这种情况下我应该怎么做?我看到有一个具有多个索引的 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("//div[contains(@id,':2y')]"));
PromotionsSection.click();
WebElement email=driver.findElement(By.xpath(".//*[@id=':1g4']/b"));
email.click();
推荐答案
认为你登录后在页面中.现在使用下面的代码:
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 收件箱中单击特定的电子邮件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何从 Selenium 的 gmail 收件箱中单击特定的电子邮件?


基础教程推荐
- FirebaseListAdapter 不推送聊天应用程序的单个项目 - Firebase-Ui 3.1 2022-01-01
- 设置 bean 时出现 Nullpointerexception 2022-01-01
- 无法使用修饰符“public final"访问 java.util.Ha 2022-01-01
- 在 Libgdx 中处理屏幕的正确方法 2022-01-01
- Java:带有char数组的println给出乱码 2022-01-01
- “未找到匹配项"使用 matcher 的 group 方法时 2022-01-01
- 减少 JVM 暂停时间 >1 秒使用 UseConcMarkSweepGC 2022-01-01
- 降序排序:Java Map 2022-01-01
- Java Keytool 导入证书后出错,"keytool error: java.io.FileNotFoundException &拒绝访问" 2022-01-01
- 如何使用 Java 创建 X509 证书? 2022-01-01