Python 3.5.2 + selenium 2.53.6 + Windows 7 + Firefox 48.0で確認したところでは、こうすると動かすことが出来ました。
Firefoxはv47以降はこの方式でないとダメのようです。
(私はこの辺に詳しくないので詳細は参考リンクをお読みください。)
Releases · mozilla/geckodriver
https://github.com/mozilla/geckodriver/releases
lang
1import unittest
2from selenium import webdriver
3from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
4
5
6class SimpleTest(unittest.TestCase):
7 def setUp(self):
8 self.url = "http://yahoo.co.jp"
9 caps = DesiredCapabilities.FIREFOX.copy()
10 caps["platform"] = "WINDOWS"
11 caps["version"] = "7"
12 caps["marionette"] = True
13 caps["binary"] = r"C:\Program Files (x86)\Mozilla Firefox\firefox.exe"
14 self.driver = webdriver.Remote(command_executor="http://127.0.0.1:4444/wd/hub/", desired_capabilities=caps)
15
16 def testAaaa(self):
17 self.driver.get(self.url)
他のブラウザーの場合は、Selenium Pythonのサイトを参照してください。
Firefoxの場合と同様に、ブラウザーごとのドライバーをパスに通しておく必要があります。
Chrome(v52.0.2743.116m)の場合は、self.driver
のところはこれだけでできました。
lang
1self.driver = webdriver.Remote(command_executor="http://127.0.0.1:4444/wd/hub/",
2 desired_capabilities=DesiredCapabilities.CHROME)
参考リンク:
Getting Started — Selenium Python Bindings 2 documentation
http://selenium-python.readthedocs.io/getting-started.html
Selenium WebDriverでFirefox47を動かす方法 - Qiita
http://qiita.com/yssg/items/a054d67bc7c7fc39b276
WebDriver - Mozilla | MDN
https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette/WebDriver
java - Unable to connect to host 127.0.0.1 issue in selenium webdriver - Stack Overflow
http://stackoverflow.com/questions/38969210/unable-to-connect-to-host-127-0-0-1-issue-in-selenium-webdriver
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
退会済みユーザー
2016/09/05 10:24