LoginSignup
3
2

More than 5 years have passed since last update.

Selenium Grid の使い方

Last updated at Posted at 2018-10-15

Arch Linux でのインストール

yay -S selenium-server-standalone

1) Hub の起動

java -jar /usr/share/selenium-server/selenium-server-standalone.jar  -role hub

ブラウザーで http://192.168.8.100:4444/grid/console にアクセス
selenium_01.png

2) ひとつめの Node の起動

java -jar /usr/share/selenium-server/selenium-server-standalone.jar  -role node

ブラウザーで http://192.168.8.100:4444/grid/console にアクセス
selenium_02.png

3) ふたつめの Node の起動

java -jar /usr/share/selenium-server/selenium-server-standalone.jar  -role node

ブラウザーで http://192.168.8.100:4444/grid/console にアクセス
selenium_03.png

テストスクリプト

Python3 で、FireFox を使います。

grid_follow_link.py
#! /usr/bin/python
# -*- coding: utf-8 -*-
#
#   grid_follow_link.py
#
#               Oct/16/2018
#
# ------------------------------------------------------------------
from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities

url = 'https://ekzemplaro.org'

driver = webdriver.Remote(
    command_executor='http://192.168.8.100:4444/wd/hub',
    desired_capabilities=DesiredCapabilities.FIREFOX)
driver.get(url)

tag = driver.find_element_by_id('ekzemplaro')
tag.click()
#
tag = driver.find_element_by_link_text('English')
tag.click()
#
# ------------------------------------------------------------------
3
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
3
2