Python Selenium - How do you click on every row element for column of web table? -


this may 2 part question forgive me if isn't written:

i'm trying webdriver go nba team stats page: http://stats.nba.com/teams/traditional/#!?sort=w_pct&dir=-1

table image reference

and click linked fgm numbers in table. should open new tab in background. far i'm lost how should approaching this.

i'm thinking:

  • i need way count rows
  • then need tell webdriver loop/click through elements in fgm column row count

i'm sure can data beautifulsoup i'm trying practice selenium , working tables/links can vary in length. leads appreciated. thanks!

python example:

from selenium import webdriver selenium.webdriver import actionchains web_driver = webdriver.firefox()  web_driver.get("http://stats.nba.com/teams/traditional/#!?sort=w_pct&dir=-1")  actions = actionchains(driver) team_links = webdriver.find_elements_by_xpath("//body//td[contains(@class, 'first')]/a")  link in team_links:     actions.key_down(keys.control).click(link).key_up(keys.control).perform() 

Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -