python selenium to click a button -
new selenium. trying click "reviews" in below chart. i've tried solutions below got error "message: unable locate element"
browser = webdriver.firefox(executable_path=r'c:\program files (x86)\mozilla firefox\geckodriver.exe') url = 'https://www.glassdoor.com/reviews/index.htm' browser.get(url) browser.find_element_by_id('keywordsearch').send_keys('google') browser.find_element_by_id('herosearchbutton').click() time.sleep(5) # click review button # none of below solution working browser.find_element(by.css_selector, "a.eicell.cell.reviews").click() browser.find_element(by.css_selector, ".eicell.cell.reviews").click() browser.find_element_by_xpath('//a[@class="eicell cell reviews" , contains(text(),"reviews")]').click() browser.find_element_by_xpath('//span[@class="subtle" , contains(text(),"reviews")]').click() browser.find_element_by_xpath('//span[@class="subtle" , contains(text(),"reviews")]/parent::a').click() browser.find_element_by_xpath("//a[@class='eicell cell reviews']//span[@class='subtle']").click()
because element has multiple classes should use:
browser.find_element(by.css_selector, ".eicell.cell.reviews").click()
Comments
Post a Comment