Selenium tests do not work

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

Selenium tests do not work

Postby ploni » Tue Aug 11, 2020 4:17 pm

Hello
I'm new here, and I'm trying to create selenium tests at CEF
I've followed steps of https://bitbucket.org/chromiumembedded/ ... eDriver.md

I managed to get CEF to go up, but it ignores Selenium's commands and WebElement searchBox causes a crash

Any help will be appreciated

selenium-server-standalone-3.141.59
selenium-server-standalone-3.9.1
selenium-server-4.0.0-alpha-6

selenium-java-4.0.0-alpha-6
selenium-java-3.141.59

cef_binary_84.4.0+g304e015+chromium-84.0.4147.105_windows32_client
cef_binary_84.4.0+g304e015+chromium-84.0.4147.105_windows64_client

ChromeDriver 84.0.4147.30

I tried all this ...

Code: Select all
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;

public class Example  {
  public static void main(String[] args) {
    // Path to the ChromeDriver executable.
    System.setProperty("webdriver.chrome.driver", "chromedriver.exe");

    ChromeOptions options = new ChromeOptions();
    // Path to the CEF executable.
    options.setBinary("./cef32/Release/cefclient.exe");
    // Port to communicate on. Required starting with ChromeDriver v2.41.
    options.addArguments("remote-debugging-port=12345");

    WebDriver driver = new ChromeDriver(options);
    driver.get("http://www.google.com/xhtml");
    sleep(3000);  // Let the user actually see something!
    WebElement searchBox = driver.findElement(By.name("q"));
    searchBox.sendKeys("ChromeDriver");
    searchBox.submit();
    sleep(3000);  // Let the user actually see something!
    driver.quit();
  }

  static void sleep(int time) {
    try { Thread.sleep(time); } catch (InterruptedException e) {}
  }
}


Code: Select all
$ java -cp ".;*" Example
Starting ChromeDriver 84.0.4147.30 (48b3e868b4cc0aa7e8149519690b6f6949e110a8-refs/branch-heads/4147@{#310}) on port 41392
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
`eb 12, 2020 12:13:27 AM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
Exception in thread "main" org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"css selector","selector":"*[name='q']"}
  (Session info: chrome=84.0.4147.105)
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
Build info: version: '3.9.1', revision: '63f7b50', time: '2018-02-07T22:42:28.403Z'
System info: host: 'DESKTOP-S0O0G6T', ip: '10.100.102.2', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_261'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 84.0.4147.105, chrome: {chromedriverVersion: 84.0.4147.30 (48b3e868b4cc0..., userDataDir: C:\Users\`xi`l\AppData\Loca...}, goog:chromeOptions: {de
buggerAddress: localhost:12345}, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: WINDOWS, platformName: WINDOWS, proxy: Proxy(), setWindowRect: true, strictFileInteractability: fa
lse, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:virtualAuthenticators: true}
Session ID: b0602006170dd793c251703a40d42a3b
*** Element info: {Using=name, value=q}
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
        at java.lang.reflect.Constructor.newInstance(Unknown Source)
        at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:187)
        at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:122)
        at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49)
        at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:160)
        at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
        at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601)
        at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:371)
        at org.openqa.selenium.remote.RemoteWebDriver.findElementByName(RemoteWebDriver.java:449)
        at org.openqa.selenium.By$ByName.findElement(By.java:303)
        at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:363)
        at Example.main(Example.java:21)


ploni
Newbie
 
Posts: 5
Joined: Sun Jul 19, 2020 12:11 am

Re: Selenium tests do not work

Postby ploni » Thu Aug 20, 2020 7:14 am

Please any help
ploni
Newbie
 
Posts: 5
Joined: Sun Jul 19, 2020 12:11 am

Re: Selenium tests do not work

Postby magreenblatt » Thu Aug 20, 2020 10:38 am

ploni wrote:
Code: Select all
Exception in thread "main" org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"css selector","selector":"*[name='q']"}
  (Session info: chrome=84.0.4147.105)
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html

Did you read that documentation? Does it work if you use Google Chrome instead of cefclient?
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Selenium tests do not work

Postby ploni » Thu Aug 20, 2020 4:49 pm

magreenblatt wrote:
ploni wrote:
Code: Select all
Exception in thread "main" org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"css selector","selector":"*[name='q']"}
  (Session info: chrome=84.0.4147.105)
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html

Did you read that documentation? Does it work if you use Google Chrome instead of cefclient?


With the Chrome browser it works.
I actually work with Python, and just for the test I did it with Java ...
The problem is not with this specific command, no command works
ploni
Newbie
 
Posts: 5
Joined: Sun Jul 19, 2020 12:11 am


Return to Support Forum

Who is online

Users browsing this forum: Google [Bot] and 37 guests