javascript - Python Selenium element not visible in pop-up window -
not sure why receiving following error.
selenium.common.exceptions.elementnotvisibleexception: message: element not visible
i attempting click on box score link after clicking on 'more' button each game (each game not have gt link matter). having issues because button showing in pop-up type window?
i have attempted resolve situation using time.sleep(5) or so, same error prints screen, not seem issue of waiting link load/appear.
here code:
schedule = 'http://www.gamecocksonline.com/sports/m-basebl/sched/scar-m-basebl-sched.html' options = webdriver.chromeoptions(); options.add_argument("--start-maximized") driver = webdriver.chrome(chrome_options=options) driver.get(schedule) #find 'more' button, scroll to, , click python_button = driver.find_elements_by_xpath("//a[@class='sch-view-more']")[idx] driver.execute_script("return arguments[0].scrollintoview();", python_button) driver.execute_script("window.scrollby(0, -150);") python_button.click() #click on box score link python_button = driver.find_element_by_xpath("//a[text()='box score']") python_button.click() #pass html beautiful soup , close browser window soup = beautifulsoup(driver.page_source) playbyplay(soup) #reads info html driver.quit()
i able resolve own issue here (thanks @debanjanb pointing out few things in comments).
adding wait time allow links become available, observing games @ top of page follow same xpath 1 searching main resolutions.
#click on box score link time.sleep(1) python_button = driver.find_elements_by_xpath("//span[@class='sch-event-related']")[-1] python_button.click()
Comments
Post a Comment