LoginSignup
2
2

More than 1 year has passed since last update.

DockerでSelenium-Grid動かすまでのメモ

Last updated at Posted at 2018-08-06

この文章

自分がDockerでSelenium動かすまでのメモ。

本体の取得

https://github.com/SeleniumHQ/docker-selenium
からGit cloneして取得。

起動

Read me に基本書いているが、複数コンテナ立ち上げのために以下のサイトを参考にした。
https://qiita.com/takayamag/items/cca4b85e75f1fcc2ab1a

ブラウザで接続

local hostではつながらなかった、理由はよくわからないがdockerのアドレスにアクセスしないとダメらしい。
以下のコマンドでチェック。

docker-machine ip

わかったらhttp://[IP]:4444/grid/consoleで接続。

VNC接続

イメージのなかでもDebugが付いているものはVNC接続ができる、 VNC のポートを取得し、接続。

docker port <コンテナID> 5900

後は上記のIPを使って接続。

参考:http://blog.cybozu.io/entry/8113

テスト

早速テスト、ドライバーのインスタンス作成時に以下を加えれば接続可能。

driver = webdriver.Remote(
    command_executor='http://[IP]:4444/wd/hub',
    desired_capabilities=DesiredCapabilities.CHROME)

あとはdriverに対して任意の作業を行う。

これから

もう少しテストを実施し、何がどこまでできるのか確認。

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2