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 收件箱中单击特定的电子邮件?
基础教程推荐
- Spring AOP错误无法懒惰地为此建议构建thisJoinPoin 2022-09-13
- REST Web 服务返回 415 - 不支持的媒体类型 2022-01-01
- 如何对 Java Hashmap 中的值求和 2022-01-01
- RabbitMQ:消息保持“未确认"; 2022-01-01
- 修改 void 函数的输入参数,然后读取 2022-01-01
- Struts2 URL 无法访问 2022-01-01
- 问题http://apache.org/xml/features/xinclude测试日志4j 2 2022-01-01
- 存储 20 位数字的数据类型 2022-01-01
- 使用堆栈算法进行括号/括号匹配 2022-01-01
- 无法复制:“比较方法违反了它的一般约定!" 2022-01-01
