使用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")
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章