Using Selenium, I am trying to read the response body of a specific email. I have navigated to the email I desire. I just cannot seem to find a static locator to grab as the class/id is dynamically allocated.
Anyone have a xpath that will allow me to read the text of any gmail body?
发布我自己的答案后,我发现了一个可用于定位的xpath:Gmail>收到的电子邮件>响应正文
//div[@class='ii gt ']//div[contains(text(),'**Insert your recognizable email text here**')]
It looks like message body is the element with class 'ii gt '
, so try this:
driver.findElement(By.cssSelector(".ii.gt")).getText()
But better option is to read messages via Gmail API .
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.