Python - selenium网页打开

时间:2018-04-12 01:06:13

标签: python selenium selenium-webdriver scripting webdriver

我在这里有一些代码可以打开一个现有的网页并点击一个标有" HTTP Ping"的按钮。它打开firefox浏览器,但实际上并没有连接到页面或单击页面功能的一个按钮。有什么帮助吗?

#!/usr/bin/python

from selenium import webdriver
driver=webdriver.Firefox()
driver.get("http://www.cloudping.info/")
element1 = driver.find_element_by_link_text("HTTP Ping")
element1.click()

现在我收到了反馈:

    Traceback (most recent call last):
  File "./finalProject", line 9, in <module>
    driver=webdriver.Firefox()
  File "/home/pjvaglic/.local/lib/python2.7/site-packages/selenium/webdriver/firefox/webdriver.py", line 80, in __init__
    self.binary, timeout)
  File "/home/pjvaglic/.local/lib/python2.7/site-packages/selenium/webdriver/firefox/extension_connection.py", line 52, in __init__
    self.binary.launch_browser(self.profile, timeout=timeout)
  File "/home/pjvaglic/.local/lib/python2.7/site-packages/selenium/webdriver/firefox/firefox_binary.py", line 68, in launch_browser
    self._wait_until_connectable(timeout=timeout)
  File "/home/pjvaglic/.local/lib/python2.7/site-packages/selenium/webdriver/firefox/firefox_binary.py", line 108, in _wait_until_connectable
    % (self.profile.path))
selenium.common.exceptions.WebDriverException: Message: Can't load the profile. Profile Dir: /tmp/tmpTfjrqh If you specified a log_file in the FirefoxBinary constructor, check it for details.

0 个答案:

没有答案