Hi All,
I used to do automation on browsrs on Winodws and Mac, and now I'm finding a way to do it on ChromeOS, but the traditional way doesn't work.
Traditional way:
1) Root my Chromebook, run "dev_install chrome_test".
2) Install JDK on ChromeOS
3) Copy chromedriver for linux and Seleniem Standalon Server to ChromeOS, Run java -Dwebdriver.chrome.driver='./chromedriver' -jar selenium-server-standalone.jar
4) Enable the 4444 in TCP channel.
5) Run the following scripts remotely:
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
options = webdriver.ChromeOptions()
options.add_argument("--no-sandbox")
options.add_argument("--disable-setuid-sandbox")
options.add_argument("--test-type")
capabilities = options.to_capabilities()
driver = webdriver.Remote(selenium_server, capabilities) On Chromebook, I could see the selenium server was started, and it received the message sent remotely. But on the client side, I hit an issue said that "Unable to create new service: "Create ChromeDriverServic.".."
Alternative Way:
It said :
Logs in ChromeOS using Telemetry.
Starts Chrome Driver with Remote mode on the Device under Test (DUT) and connects to the remote debug port of the Chrome instance after log in.
Exposes a driver instance for you to make any Chrome Driver calls.
Shutdowns Chrome Driver process, and logs out of ChromeOS.
在此输入代码...
import the wrapper class
from autotest_lib.client.common_lib.cros import chromedriver
Create an instance of the Chrome Driver, and make calls.
with chromedriver.chromedriver() as chromedriver_instance:
driver = chromedriver_instance.driver
# Here you can make standard Chrome Driver calls through the driver instance.
# For example, browse a given url with |driver.get(url)|
- I renamed it as autotest_lib, run "from autotest_lib.client.common_lib.cros import chromedriver" in python, but several modules were missing, such as telemetry and catapult_base, I found telemetry and catapult in https://github.com/catapult-project/catapult, but I think it's a stupid way to download all the missing packages.Q1: So is there a way to setup the environment to run the codes above?
- The guide said that 1. Logs in ChromeOS using Telemetry. 2. Starts Chrome Driver with Remote mode on the Device under Test (DUT) and connects to the remote debug port of the Chrome instance after log in. Q2: How to logs in ChromeOS using Telemtry? I followed the guide in https://www.chromium.org/developers/telemetry/running-telemetry-on-chrome-os. But couldn't setup autotest since test_that was not available on my ChromeOS.The version of the Linux embed in my ChromeOS is Linux 4.4.79-11654-g7e0f59a105a1 x86_64 Intel(R) Celeron(R) CPU N2840 @ 2.16GHz GenuineIntel GNU/Linux. Q3:What should I do to enable test_that?
- Q4: I searched a lot on how to use Selenium on ChromeOS, but found little. Has anyone done this? I'd like to make sure this is the precise way to open a browser automatically like selenium does on other platforms?
Thanks in advance!