使用selenium+firefox做网站下载文件

环境:centos el7.x86_64系统+python2.7.5+selenium 3.13.0+geckodriver_0.21.0+firefox_60.1.0

问题:使用browser.execute_script("window.open(url)")
新链接无法使用新标签窗口

解决:使用browser.execute_script("window.open(url,'_self')") 在本页面打开新链接
依然存在问题:SessionNotCreatedException: Message: Tried to run command without establishing a connection

                 改变js的方法:browser.execute_script("window.location.href=url")

猜你喜欢

转载自blog.51cto.com/13884757/2149392