0

I have a C++ application application.exe, which uses a CEF browser (chrome embedded framework) as the UI.

For this UI I want to develop automated tests with Selenium. Usually I control Selenium via Java.

below is the stack trace I'm getting:

Starting ChromeDriver 91.0.4472.101 (af52a90bf87030dd1523486a1cd3ae25c5d76c9b-refs/branch-heads/4472@{#1462}) on port 36815
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.

org.openqa.selenium.WebDriverException: chrome not reachable
Build info: version: '3.13.0', revision: '2f0d292', time: '2018-06-25T15:24:21.231Z'
System info: host: 'NO1010042072000', ip: '10.42.72.0', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '15.0.2'
Driver info: driver.version: ChromeDriver
remote stacktrace: Backtrace:
    Ordinal0 [0x006C3733+2504499]
    Ordinal0 [0x0065C401+2081793]
    Ordinal0 [0x005624F0+1058032]
    Ordinal0 [0x005574B5+1012917]
    Ordinal0 [0x0058005B+1179739]
    Ordinal0 [0x0057C58C+1164684]
    Ordinal0 [0x00579DC3+1154499]
    Ordinal0 [0x005A9B82+1350530]
    Ordinal0 [0x005A97DA+1349594]
    Ordinal0 [0x005A5D4B+1334603]
    Ordinal0 [0x005822B4+1188532]
    Ordinal0 [0x00583149+1192265]
    GetHandleVerifier [0x0083FB8C+1512252]
    GetHandleVerifier [0x008EB0DF+2214031]
    GetHandleVerifier [0x00744BC3+484211]
    GetHandleVerifier [0x00743E69+480793]
    Ordinal0 [0x0066218D+2105741]
    Ordinal0 [0x006666E8+2123496]
    Ordinal0 [0x00666827+2123815]
    Ordinal0 [0x0066FB73+2161523]
    BaseThreadInitThunk [0x74EAFA29+25]
    RtlGetAppContainerNamedObjectPath [0x77037C7E+286]
    RtlGetAppContainerNamedObjectPath [0x77037C4E+238]

My code snippet:

System.setProperty("webdriver.chrome.driver", "C:\\Users\\Administrator\\Desktop\\chromedriver_win32\\chromedriver.exe");
        
        
    ChromeOptions options = new ChromeOptions();
        
    options.setBinary(<cef_workflow_path>);
        
WebDriver chDriver = new ChromeDriver(options);
    
    
    
     
sleep(3000);
    
chDriver.findElement(By.id("EmailPage-EmailField"));
       
WebElement email = chDriver.findElement(By.id("EmailPage-EmailField"));
         
System.out.println(email.isDisplayed());
       
email.clear();
     
email.sendKeys(userName);
Sourav Kumar
  • 41
  • 1
  • 11

2 Answers2

0

I see you truing to access web element on the web page before you passed an URL to the driver.
You need first to

chDriver.get(yourURLLink);

and only after that, when the page is loaded try accessing the elements with

chDriver.findElement(By.id("EmailPage-EmailField"));

etc.

Prophet
  • 32,350
  • 22
  • 54
  • 79
  • The application will open the embedded browser page, hence I'm adding a sleep. And the url opened in that page will be dynamic. – Sourav Kumar Jun 27 '21 at 09:28
0

Can you check with this, I hope it will work for you

ChromeOptions option = new ChromeOptions();
    
    option.addArguments(new ArrayList<String>() {
        {
            add("--no-sandbox");
            add("--disable-gpu-sandbox");
            
        }
    });
    
    WebDriver driver = new ChromeDriver(option);
YaDav MaNish
  • 1,260
  • 2
  • 12
  • 20