使用Python启动浏览器(Chromium)并更改URL
I am trying to write a script that makes it possible to change the url of an active process.
我正在尝试编写一个脚本,可以更改活动进程的URL。
So for instance, I am starting my browser using:
例如,我正在使用以下命令启动浏览器:
browser = Popen(["chromium", "http://www.google.com"])
After an X interval I want to change the url of browser.
在X间隔后,我想更改浏览器的URL。
I've tried allot of things to get this result but nothing has succeeded so far. (stdin.write / put (PIPE) etc etc.).
我已经尝试了很多东西来获得这个结果,但到目前为止还没有任何成功。 (stdin.write / put(PIPE)等等)。
browser = sh.Command('uzbl-browser')(print_events=True, config='-', uri=current_browser_url, _bg=True)
browser.process.stdin.put('uri http://www.google.nl' + '\n')
I'm hoping you can help me out with this.
我希望你能帮我解决这个问题。
Regards,
Wesley.
4 个解决方案
#1
if you work with browsers + python, you'll probably want to take a look at Selenium. It's not copy-paste but you can learn it in couple of hours...
如果你使用browser + python,你可能想看看Selenium。这不是复制粘贴,但你可以在几个小时内学习它...
http://www.seleniumhq.org/
更多相关文章
- 第五十九节,模拟浏览器请求Python结合html基本格式
- 从QQ浏览器缓存文件中提取出完整的视频
- (转载)浏览器兼容性问题大汇总
- Android中轴旋转特效实现,制作别样的图片浏览器
- 关于selenium android下的浏览器测试
- js 区分浏览器来源是PC端还是移动端
- JS唤醒Android APP(包括在外部浏览器和WebView)
- javascript(六)js事件绑定浏览器兼容解决方案 attachEvent addEve
- 在Java中,使用DefaultSelenium对象在selenium中启动测试,我如何找