Arch Linux でのインストール
yay -S selenium-server-standalone
- Hub の起動
java -jar /usr/share/selenium-server/selenium-server-standalone.jar -role hub
- ひとつめの Node の起動
java -jar /usr/share/selenium-server/selenium-server-standalone.jar -role node
- ふたつめの Node の起動
java -jar /usr/share/selenium-server/selenium-server-standalone.jar -role node
テストスクリプト
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()
#
# ------------------------------------------------------------------