Reputation: 169
class="conversation hasLabels read"
Hello, everyone, I am trying to access an unread email using a for loop and specifying a class
browser.find_by_css(.conversation.hasLabels.hasAttachments)
The problem here is some emails have class="read" so when the for loop executes, it takes all the read ones also but that is a problem since the emails don't have an unread element. For better understanding, I would like to access a class providing exclusive parameters.
Upvotes: 0
Views: 150
Reputation: 1148
It can help you if I understood the essence of the problem correctly:
browser.find_by_xpath('//*[contains(@class, "conversation")][contains(@class, "hasLabels")][not(contains(@class, "read"))]')
Upvotes: 0
Reputation: 55002
You can just add a :not
.conversation.hasLabels.hasAttachments:not(.read)
Upvotes: 0
Reputation: 169
Apparently using the script this way grabs only what you ask so this solves my problem.
browser.find_by_css('div[class="conversation hasLabels hasAttachments"]')
Upvotes: 1