Last active
November 27, 2019 19:16
-
-
Save juanitobanca/f7eb6076f52c4632693b4fe60798c246 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from selenium import webdriver | |
from selenium.webdriver.support.ui import Select, WebDriverWait | |
driver = webdriver.PhantomJS() | |
def obtenerRoster( teamId ): | |
tables = [ 'rosterPitchers', 'rosterCatchers', 'rosterInfielders', 'rosterOutfielders' ] | |
url = 'http://www.milb.com/roster/index.jsp?cid='+str(teamId) | |
driver.get( url ) | |
for t in tables: | |
ti = driver.find_element_by_xpath('//*[@id="'+t+'"]/div/div[1]/table/tbody') | |
for ri in ti.find_elements_by_tag_name('tr'): | |
for ci in ri.find_elements_by_tag_name('td'): | |
print( ci.text ) | |
obtenerRoster( 672 ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment