2017-10-11 173 views
0

我试图刮掉此网页的结果:Python网络刮硒/请求

https://results.chronotrack.com/event/results/event/event-24381

这是我可以手动执行:

1)打开上述网址铬

2)点击结果标签

2.5)有时改变种族距离

3)单击下一步去2页

4)打开开发工具/网络

5)单击上一步回到第一页

6)获取从结果的请求URL -Grid回调元素从开发工具:

https://results.chronotrack.com/embed/results/results-grid?callback=results_grid17740402&sEcho=7&iColumns=11&sColumns=&iDisplayStart=0&iDisplayLength=100&mDataProp_0=0&mDataProp_1=1&mDataProp_2=2&mDataProp_3=3&mDataProp_4=4&mDataProp_5=5&mDataProp_6=6&mDataProp_7=7&mDataProp_8=8&mDataProp_9=9&mDataProp_10=10&raceID=60107&bracketID=638654&intervalID=121077&entryID=&eventID=24381&eventTag=event-24381&oemID=www.chronotrack.com&genID=17740402&x=1507682443198&_=1507682443198

一旦我得到了这么远,我可以操纵DisplayStart参数,以获得结果的其余部分。

有我的方式找到使用要求和/或硒那样的网址是什么?硒我试图打开的第一个页面然后单击到的结果与以下几点:

driver.find_element_by_id('resultsResultsTab').click() 

,但我得到了以下错误:

Element is not currently visible and may not be manipulated 

谁能帮我指出了正确的方向?

回答

1

尽量等到需要的元素变得可见:

from selenium.webdriver.support.ui import WebDriverWait as wait 
from selenium.webdriver.support import expected_conditions as EC 
from selenium.webdriver.common.by import By 

wait(driver, 10).until(EC.visibility_of_element_located((By.ID, 'resultsResultsTab'))).click() 
+0

这工作,谢谢! – user3449833