roadlabs / chromiumembedded

Automatically exported from code.google.com/p/chromiumembedded
0 stars 1 forks source link

CEF3: Add WebDriver support #549

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
WebDriver is an implementation of the selenium browser automation framework 
(http://code.google.com/p/selenium/). The implementation currently lives inside 
the browser/ folder but it should ideally be able to drive any WebKit-based 
browser.

The WebDriver implementation in Chrome is currently composed of two parts:

1. A separate WebDriver executable (chrome/test/webdriver) that drives the 
Chrome executable.

2. The WebDriver automation layer (chrome/test/automation, 
chrome/browser/automation) built into the Chrome executable.

The WebDriver executable can potentially be shared between the Chrome browser 
and other consumers of the content API. The WebDriver automation layer can be 
refactored into a series of delegates that allow Chrome and other consumers of 
the content API to provide their own implementations.

Original chromium-dev thread on this topic:
http://groups.google.com/a/chromium.org/group/chromium-dev/browse_thread/thread/
1df42d7895c4f677#

Chromium issue: http://code.google.com/p/chromium/issues/detail?id=110619

Original issue reported on code.google.com by magreenb...@gmail.com on 15 Mar 2012 at 2:31

GoogleCodeExporter commented 9 years ago

Original comment by magreenb...@gmail.com on 15 Mar 2012 at 2:32

GoogleCodeExporter commented 9 years ago
The CEF3 implementation will be based on the Chromium automation API currently 
under development. More information: 
https://groups.google.com/a/chromium.org/forum/?fromgroups&hl=en#!topic/chromium
-dev/vQMRxI6HFl4%5B1-25%5D

Original comment by magreenb...@gmail.com on 9 Aug 2012 at 3:36

GoogleCodeExporter commented 9 years ago
Just curious if you know of any update on this work. The last post in the 
thread you linked to was from July. I am very interested in using webdriver to 
create automated tests for CEF hosted pages.

If it is stalled and there is any way I can help let me know.

Original comment by jmay...@google.com on 19 Oct 2012 at 11:31

GoogleCodeExporter commented 9 years ago
Test automation for CEF3 can be implemented currently using the DevTools remote 
debugging protocol. For example: 
http://www.igvita.com/2012/04/09/driving-google-chrome-via-websocket-api/

Google has decided to implement WebDriver support as an extension of the 
DevTools protocol. More information in this thread: 
https://groups.google.com/a/chromium.org/forum/?fromgroups=#!topic/chromium-dev/
yGta7vfanp8

General information on remote debugging: 
https://developers.google.com/chrome-developer-tools/docs/remote-debugging

Original comment by magreenb...@gmail.com on 22 Oct 2012 at 7:25

GoogleCodeExporter commented 9 years ago
Any thoughts on the expected release of this functionality? I am looking into 
support my development team who are using CEF to build their products, and they 
want us to develop support for automated testing. I am wondering how much 
effort we should expend our efforts, and if we were to expect CEF-webdriver 
support, what the anticipated dates would be.

Original comment by bino...@gmail.com on 10 Dec 2012 at 4:26

GoogleCodeExporter commented 9 years ago
@comment #5: The remote debugging protocol can currently be used for automated 
testing. You don't need to wait for the extensions that Google is proposing.

Original comment by magreenb...@gmail.com on 10 Dec 2012 at 4:34

GoogleCodeExporter commented 9 years ago
@comment 6: Thanks for the update. If I want to provide users with a Java api 
that has the look and feel of the webdriver style api to control and drive CEF 
windows, without having access to the extensions (so I can eventually start 
using the webdriver support once available without users knowing about the 
switch), is the recommended approach then to wrap around the debugging protocol 
with my Java api?

Also, when the webdriver support is available, will it be a different driver 
executable (similar to chromedriver.exe) that works with the existing 
ChromeDriver client apis?

Thanks

Original comment by bino...@gmail.com on 10 Dec 2012 at 7:59

GoogleCodeExporter commented 9 years ago
There's a chrome dev tools Java API:

http://code.google.com/p/chromedevtools/

Original comment by alav...@system42.net on 10 Dec 2012 at 9:18

GoogleCodeExporter commented 9 years ago
Thanks for the pointer here. I have tried to use the Java SDK for 
chromedevtools and I am basically able to get some info such as tab count, url 
, title etc. But it was not so clear whether I could navigate, find elements 
etc. 

The question is: if I want to use a ChromeDriver Java api for controlling a CEF 
window, should I go ahead and try to build a webdriver implementation using the 
sdk as the basis, or is there a shorter route, such as modifying the existing 
Chromedriver, and making it connect to CEF instead of Chrome? CEF in my case is 
already up and running unlike the chrome case with ChromeDriver Java.

Original comment by bino...@gmail.com on 4 Jan 2013 at 7:29

GoogleCodeExporter commented 9 years ago
Was there any update to this?  Will WebDriver be supported?

Original comment by umair.chagani on 4 Feb 2013 at 6:23

GoogleCodeExporter commented 9 years ago
Google has released an alpha of ChromeDriver2, the re-implementation of 
ChromeDriver using the DevTools remote debugging protocol. I haven't looked at 
it in detail to determine what changes, if any, are required to use it with 
CEF3. https://code.google.com/p/chromedriver/wiki/ChromeDriver2

Original comment by magreenb...@gmail.com on 30 Apr 2013 at 3:07

GoogleCodeExporter commented 9 years ago
It seems that the ChromeDriver2 Project has graduated to release, the wiki says 
it is the recommended one and Downloads lists the 1.* as deprecated.

Original comment by Daniel.S...@gmail.com on 24 Jun 2013 at 6:52

GoogleCodeExporter commented 9 years ago
I have tested the latest ChromeDriver2 and it works with CEF.

Search location for your app can be set like so: 
ChromeOptions options = new ChromeOptions();
options.setBinary("/path/to/your/app.exe");
WebDriver driver = new ChromeDriver(options);

make sure you are getting your remote debugging port from command line and not 
setting it manually.

Original comment by Daniel.S...@gmail.com on 24 Jun 2013 at 6:08

GoogleCodeExporter commented 9 years ago
Is that with CEF1 or CEF3?
From Java, using
 ChromeOptions options = new ChromeOptions();
 options.setBinary("blah\\cef_binary_3.1364.1094_windows\\Release\\cefclient.exe");
 WebDriver driver = new ChromeDriver(options);

shows
[0.892][INFO]: received WebDriver request: GET /status 
[0.893][INFO]: sending WebDriver response: 200 {
   "sessionId": "",
   "status": 0,
   "value": {
      "build": {
         "version": "alpha"
      },
      "os": {
         "arch": "x86_64",
         "name": "Windows NT",
         "version": "6.1 SP1"
      }
   }
}
[1.072][INFO]: received WebDriver request: POST /session {
   "desiredCapabilities": {
      "browserName": "chrome",
      "chrome.binary": "blah\\cef_binary_3.1364.1094_windows\\Release\\cefclient.exe",
      "chrome.switches": [  ],
      "chromeOptions": {
         "args": [  ],
         "binary": "blah\\cef_binary_3.1364.1094_windows\\Release\\cefclient.exe",
         "extensions": [  ]
      },
      "platform": "ANY",
      "version": ""
   }
}
[1.085][INFO]: Launching chrome: 
"blah\cef_binary_3.1364.1094_windows\Release\cefclient.exe" 
--remote-debugging-port=51017 --no-first-run --enable-logging --logging-level=1 
--user-data-dir="C:\Users\bill-lap\AppData\Local\Temp\scoped_dir11456_21147" 
--load-extension="C:\Users\bill-lap\AppData\Local\Temp\scoped_dir11456_24744\int
ernal" --ignore-certificate-errors data:text/html;charset=utf-8,
[3.891][INFO]: sending WebDriver response: 200 {
   "sessionId": "",
   "status": 13,
   "value": {
      "message": "unknown error: Chrome version must be \u003E= 27.0.1453.0\nfrom unknown error: version info doesn't include string 'Browser'\n  (Driver info: chromedriver=2.0,platform=Windows NT 6.1 SP1 x86_64)"
   }
}
org.openqa.selenium.WebDriverException: unknown error: Chrome version must be 
>= 27.0.1453.0
from unknown error: version info doesn't include string 'Browser'
  (Driver info: chromedriver=2.0,platform=Windows NT 6.1 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 4.07 seconds
Build info: version: '2.33.0', revision: '4e90c97', time: '2013-05-22 15:33:32'
System info: os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', 
java.version: '1.7.0_03'
Driver info: org.openqa.selenium.chrome.ChromeDriver
    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.ErrorHandler.createThrowable(ErrorHandler.java:191)
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:554)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:216)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:111)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:115)
    at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:161)
    at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:139)
    at Test.testGoogleSearch(Test.java:23)
    at Test.main(Test.java:40)

Original comment by breyno...@promia.com on 26 Jun 2013 at 5:44

GoogleCodeExporter commented 9 years ago
This is only about CEF3.

You need to update CEF - you need at least 3.1453.* (latest binary release 
seems ok). You have 3.1364.*
I was compiling latest from source, so even if latest binary is not working, it 
will work in the next binary release.

Original comment by Daniel.S...@gmail.com on 26 Jun 2013 at 6:02

GoogleCodeExporter commented 9 years ago
Unfortunately, looks like the wiki page for Chromdriver 2 has been taken down. 
Has this effort been abandoned? 

Original comment by amol.m...@gmail.com on 8 Aug 2013 at 6:54

GoogleCodeExporter commented 9 years ago
@comment#16: ChromeDriver2 is now the current version (no longer alpha/beta). 
Not sure what happened to the wiki page.

Original comment by magreenb...@gmail.com on 8 Aug 2013 at 7:04

GoogleCodeExporter commented 9 years ago
ChromeDriver2 has been verified to work with CEF3.

Original comment by magreenb...@gmail.com on 15 Aug 2013 at 7:40

GoogleCodeExporter commented 9 years ago
I have tried to open my binary using below code :

File chromium = new File("D:\\CefClient\\CefClient\\cefclient.exe");
System.setProperty("webdriver.chrome.driver","C:/Users/deepaky/workspace/support
_bijli/src/chromedriver.exe");
ChromeOptions options = new ChromeOptions();
options.setBinary(chromium);

WebDriver driver = new ChromeDriver(options);

it launched the application but after that it thrown the error below and am not 
getting why i got this

Exception in thread "main" org.openqa.selenium.WebDriverException: chrome not 
reachable
  (Driver info: chromedriver=2.2,platform=Windows NT 6.1 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 24.59 seconds
Build info: version: '2.25.0', revision: '17482', time: '2012-07-18 21:09:54'
System info: os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', 
java.version: '1.7.0_25'
Driver info: driver.version: ChromeDriver
Session ID: 670acb9e9f33f35dd7586ec7cff68576
    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.ErrorHandler.createThrowable(ErrorHandler.java:188)
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:498)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:182)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:110)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:114)
    at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:165)
    at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:141)
    at Chromiumtest.test2.main(test2.java:20)

Original comment by deepakya...@gmail.com on 20 Aug 2013 at 1:11

GoogleCodeExporter commented 9 years ago
Is it possible you are setting "remote_debugging_port" manually instead of 
letting it come from the command line?

Original comment by Daniel.S...@gmail.com on 20 Aug 2013 at 1:14

GoogleCodeExporter commented 9 years ago
no,because everytime it launches on different port

Original comment by deepakya...@gmail.com on 21 Aug 2013 at 5:23

GoogleCodeExporter commented 9 years ago
Issue 1218 has been merged into this issue.

Original comment by magreenb...@gmail.com on 24 Feb 2014 at 3:10

GoogleCodeExporter commented 9 years ago
[21.310][INFO]: sending WebDriver response: 200 {

   "sessionId": "",

   "status": 100,

   "value": {

      "message": "chrome not reachable\n  (Driver info: chromedriver=0.9,platform=Windows NT 6.1 SP1 x86_64)"

   }

}

[21.337][INFO]: received WebDriver request: GET /shutdown 
[21.337][INFO]: sending WebDriver response: 200 {

   "sessionId": "",

   "status": 0,

   "value": null

}

Started ChromeDriver (v0.9) on port 10984
Exception in thread "main" org.openqa.selenium.WebDriverException: chrome not 
reachable
  (Driver info: chromedriver=0.9,platform=Windows NT 6.1 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 21.40 seconds
Build info: version: '2.40.0', revision: 'fbe29a9', time: '2014-02-19 20:55:11'
System info: host: 'PVGD50803902A', ip: '10.58.93.111', os.name: 'Windows 7', 
os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_09'
Driver info: org.openqa.selenium.chrome.ChromeDriver
    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.ErrorHandler.createThrowable(ErrorHandler.java:193)
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:573)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:218)
    at org.openqa.selenium.chrome.ChromeDriver.startSession(ChromeDriver.java:181)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:113)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:117)
    at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:160)
    at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:149)
    at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:138)
    at test.selenium.testSetup.main(testSetup.java:35)

Original comment by zhangwei...@gmail.com on 12 Jun 2014 at 2:56

GoogleCodeExporter commented 9 years ago
Anyone could help with above error, using chromdriver2 and CEF3

Original comment by zhangwei...@gmail.com on 12 Jun 2014 at 2:57

GoogleCodeExporter commented 9 years ago
Zhangwei are you using the latest chromedriver?  
http://chromedriver.storage.googleapis.com/index.html?path=2.10/  I also got 
this working with the latest version of CEF3

Original comment by lee.gix...@gmail.com on 19 Jun 2014 at 3:42

GoogleCodeExporter commented 9 years ago
Hi Lee,

Can you post the steps you've followed to get it work please?

Thx
Zab

Original comment by zabra...@gmail.com on 19 Jun 2014 at 4:33

GoogleCodeExporter commented 9 years ago
Zab

I don't have a tonne of details, but what I can give you is what we used to 
prove this out, we used Ubuntu 13.10 and CEF3 prebuilt binaries. 
(http://cefbuilds.com/) I believe 1750 at the time.

Used selenium webdriver 2.41.0 and chromedriver 2.9.  
Set the remote debug address using flags see: 
http://peter.sh/experiments/chromium-command-line-switches/
Connected to the remote address using the experimental options in chromedriver: 
options.setExperimentalOption("debuggerAddress", "127.0.0.1:8088")
See: https://sites.google.com/a/chromium.org/chromedriver/capabilities (The 
docs are not 100% perfectly accurate.  Check the changelog and source)
We then manually fired up the CEF build with the necessary flags and remotely 
connected to it and started running tests.
I believe there was a couple hoops we had to jump through for read\write 
permissions or default flag settings in our custom CEF3 build...
The test platform was grails with geb/spock...
I hope that helps.

Cheers
Lee

Original comment by lda...@compcc.com on 20 Jun 2014 at 8:23

GoogleCodeExporter commented 9 years ago
Hi Lee,
I had a CEF3 application, but I can't launch it successfully. The application 
will redirect the localhost:port to  a servlet url. Could you help how could I 
launch it.
The log is below:
[9.093][INFO]: received WebDriver request: GET /h5v2/index.html 
[9.093][INFO]: sending WebDriver response: 404 unknown command: h5v2/index.html
[26.775][INFO]: sending WebDriver response: 200 {

   "sessionId": "",

   "status": 100,

   "value": {

      "message": "chrome not reachable\n  (Driver info: chromedriver=0.9,platform=Windows NT 6.1 SP1 x86_64)"

   }

}

Original comment by zhangwei...@gmail.com on 15 Jul 2014 at 4:04

GoogleCodeExporter commented 9 years ago
Hi All,
I have a CEF3 application built on below details, can someone help me how to 
launch it with Selenium/chromedriver 
application details:
CEF: 3.1916.1701
Chromium: 35.0.1916.86
OS: Windows
WebKit: 537.36
JavaScript: 3.25.28.15
Flash:  
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like 
Gecko) Chrome/35.0.1916.86 Safari/537.36
Command Line: cefclient.exe --no-sandbox --lang=en-US help
Module Path: C:\Program Files (x86)\<Product>\<Component>\libcef.dll
Cache Path: C:\Users\<Username>\AppData\Local\Temp\scoped_dir5028_16981

What I used:
selenium webdriver java 2.41.0 and chromedriver 2.10
code:
System.setProperty("webdriver.chrome.driver", 
"C:\\webdrivers\\chromedriver.exe");
ChromeOptions options = new ChromeOptions();
options.setBinary(new File("C:\Program Files 
(x86)\<Product>\<Component>\\cefclient.exe"));
options.addArguments("--no-sandbox --lang=en-us");
WebDriver cefDriver=new ChromeDriver(options);

Console:
Starting ChromeDriver (v2.10.267521) on port 33000
Only local connections are allowed.
Exception in thread "main" org.openqa.selenium.WebDriverException: unknown 
error: Chrome failed to start: crashed
  (Driver info: chromedriver=2.10.267521,platform=Windows NT 6.1 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 61.71 seconds
Build info: version: '2.41.0', revision: '3192d8a', time: '2014-03-27 17:18:15'

Original comment by ananthna...@gmail.com on 12 Aug 2014 at 11:24

GoogleCodeExporter commented 9 years ago
Hi,

I will be using Google Chrome within an application i.e Chrome Embedded within 
an application.
Can webdriver be used to test that browser which is opening within the 
application.

Thanks,
Cinny

Original comment by cinnysav...@gmail.com on 18 Dec 2014 at 8:55

GoogleCodeExporter commented 9 years ago
I've added a short tutorial explaining how to automate CEF with ChromeDriver 
and Java: https://code.google.com/p/chromiumembedded/wiki/UsingChromeDriver

Original comment by magreenb...@gmail.com on 11 Feb 2015 at 11:50