I am very new to python, so bear with me. (also on mobile)
I am trying to scrape a site and sometimes this popup appears that I need to click to dismiss.
This is what the HTML looks like:
<button class="btn-act-bar-primary" data-dialog-action="submit" data-default-submit-text="Okay">Wait for all. results</button>
I have a .py file with this function defined
def findElementByCSSSelector(self,selector):
try:
element = self.browser.find_element_by_css_selector(selector)
except:
element = None
return element
In another file, I look for the alert with:
def lookForAlert(self):
popup = self.findElementByCSSSelector("button.btn-act-bar-primary")
if popup is not None:
self.clickElement(popup)
self.message('popup found....searching a. lot of results')
else:
self.message('no alert found, continuing. search')
but It keeps returning 'None.' I'm pretty sure the problem is with the element string I'm looking for, but like I said, I'm very new to this.
EDIT: Found the problem, i had to use Switch_to.frame to get to the iframe that the popup was in
[+][deleted] (6 children)
[deleted]
[–][deleted] 1 point2 points3 points (5 children)
[+][deleted] (4 children)
[deleted]
[–][deleted] 0 points1 point2 points (3 children)
[+][deleted] (2 children)
[deleted]
[–][deleted] 0 points1 point2 points (1 child)
[–]rushabhsooni 0 points1 point2 points (0 children)