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)