Jquery 浏览器自动执行任务
所以我在一个有播放列表的网页上看一些视频。播放列表的问题在于它不能“自动播放”。因此,每次一个视频结束时,我都必须手动转到播放列表并单击“下一步”链接 有没有办法让这一切自动化?比如:Jquery 浏览器自动执行任务,jquery,python,google-chrome,Jquery,Python,Google Chrome,所以我在一个有播放列表的网页上看一些视频。播放列表的问题在于它不能“自动播放”。因此,每次一个视频结束时,我都必须手动转到播放列表并单击“下一步”链接 有没有办法让这一切自动化?比如: 1.go to this page 2.select the active item in the list(which contains the video duration) 3.extract the video duration from the active item and let the video
1.go to this page
2.select the active item in the list(which contains the video duration)
3.extract the video duration from the active item and let the video play
4.After video duration, ex: 4min, click on the next element of the list and let it play for the video duration...
...
我很熟悉python和jquery。使用谷歌chrome控制台可以做到这一点吗?或者我可以运行的任何外部脚本?我也看过Imacro,但它记录了特定的iTen,我需要一些动态/程序化的东西。如查找活动选定项的下一个元素
提前感谢各位。您可以使用它来自动化各种浏览器
PyPI中有针对Selenium的示例-您可以在链接页面上看到一些代码示例,例如:
- 打开新的Firefox浏览器
- 加载雅虎主页
- 搜索“seleniumhq”
- 关闭浏览器
谢谢你的DNA输入。只是一个简单的问题:是否可以告诉代码保持4分钟(视频持续时间),然后单击下一个链接?谢谢你可以使用
time.sleep()
。另请参阅,了解等待某些情况发生的方法。
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
browser = webdriver.Firefox()
browser.get('http://www.yahoo.com')
assert 'Yahoo!' in browser.title
elem = browser.find_element_by_name('p') # Find the search box
elem.send_keys('seleniumhq' + Keys.RETURN)
browser.quit()