aerokube / cm

Configuration manager for Aerokube products
https://aerokube.com/cm/latest/
Apache License 2.0
119 stars 31 forks source link

Unable to launch browser for chrome-mobile and Android #290

Closed qatestingravi closed 3 years ago

qatestingravi commented 3 years ago

Environment: Windows 10, subsystem Linux ubuntu 20.04, Selenoid 1.7.2, docker 20.10.5

Steps to reproduce:

  1. start selenoid with below command ./cm_linux_amd64 selenoid start -j browsers.json -f -service-startup-timeout 2m -session-attempt-time out 2m
  2. Scripts to execute test in android

    @Test public void androidTest() throws Exception {

    DesiredCapabilities capabilities = new DesiredCapabilities();
    capabilities.setCapability("browserName", "android");
    capabilities.setCapability("browserVersion", "10.0");
    capabilities.setCapability("enableVNC", true);
    capabilities.setCapability("enableVideo", false);
    
    RemoteWebDriver driver = new RemoteWebDriver(
            URI.create("http://localhost:4444/wd/hub").toURL(),
            capabilities);
    driver.manage().timeouts().implicitlyWait(120, TimeUnit.SECONDS);
    driver.get("http://www.google.com");
    System.out.println("current url: " + driver.getCurrentUrl());

    }

    @Test public void chromeMobileTest() throws Exception {

    DesiredCapabilities capabilities = new DesiredCapabilities();
    capabilities.setCapability("browserName", "chrome");
    capabilities.setCapability("browserVersion", "mobile-75.0");
    capabilities.setCapability("enableVNC", true);
    capabilities.setCapability("enableVideo", false);
    
    RemoteWebDriver driver = new RemoteWebDriver(
            URI.create("http://localhost:4444/wd/hub").toURL(),
            capabilities);
    driver.manage().timeouts().implicitlyWait(120, TimeUnit.SECONDS);
    driver.get("http://www.google.com");
    System.out.println("current url: " + driver.getCurrentUrl());

    }

Expected: browser should be launched

Actual: Getting below error for androidTest and chromeMobileTest. org.openqa.selenium.WebDriverException: wait: http://192.168.176.3:4444/wd/hub does not respond in 30s

browser.json file: { "chrome": { "default": "mobile-75.0", "versions": { "mobile-75.0": { "image": "selenoid/chrome-mobile:75.0", "port": "4444", "path": "/wd/hub" } } }, "android": { "default": "10.0", "versions": { "10.0": { "image": "selenoid/android:10.0", "port": "4444", "path": "/wd/hub" } } } }

Note: selenoid is started sucessfully and able to see the selenoid-ui. See the snapshot for reference selenoid config manager selenoid ui selenoid android issue

vania-pooh commented 3 years ago

@qatestingravi do you have nested virtualization enabled on your VM? also should set -session-attempt-timeout 2m flag for Android as it can take more than 30 seconds to start.

qatestingravi commented 3 years ago

@vania-pooh I am using WSL2 ubuntu in Windows 10 home, nested virtualization is not enabled in WSL2 ubuntu. I tried to enable it with the below command but no success. Set-VMProcessor -VMName RaviLaptop -ExposeVirtualizationExtensions $true

Got below Error: Set-VMProcessor : The term 'Set-VMProcessor' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

powershell for hyper v enable

Query1: Is nested virtualization required for chrome mobile also as it also throwing 30s timeout error? Query2: I have started the selenoid with flag "-session-attempt-timeout 2m" but it seems to be ignored(See step 1 in steps to reproduce section)

vania-pooh commented 3 years ago

@qatestingravi 1) Nested VM is strictly required. 2) Should be something like this:

./cm_linux_amd64 selenoid start -j browsers.json -f  --args '-service-startup-timeout 2m -session-attempt-timeout 2m'
qatestingravi commented 3 years ago

@vania-pooh thanks for the update, as of now I am facing challenge to enable nested virtualization in wsl2. For now, I am closing the ticket, will open if required.