【发布时间】:2017-08-02 15:08:06
【问题描述】:
我正在尝试使用 Selenium 远程运行网页,然后触发按钮单击它。我能够成功打开 Firefox,但网页没有加载,并且 Firefox 会在一段时间后自动关闭。 (尝试了 google.com 和其他页面作为测试,也没有加载)。谁能建议在这里做什么?
操作系统 - Ubuntu 14.04.1
Python - 2.7.6
硒 - 3.3.0
火狐 - 39.0.3
这是我的python代码
import urllib, urllib2, cookielib
from contextlib import closing
from selenium import webdriver
from selenium.webdriver import Firefox # pip install selenium
from selenium.webdriver.support.ui import WebDriverWait
with closing(Firefox(executable_path="/usr/bin/firefox")) as driver:
driver.implicitly_wait(10)
driver.get("https://www.google.com")
#driver.get("http://wsb.com/Assingment2/expcase16.php")
button = driver.find_element_by_id('send')
button.click()
target_window = driver.window_handles[1]
driver.switch_to_window(target_window)
exploit_page_content = driver.page_source
print "Exploit successful \n" + exploit_page_content
【问题讨论】:
-
您是否在控制台上看到任何错误消息?
标签: python selenium firefox selenium-webdriver selenium-firefoxdriver