CEF not working when running selenium tests in off-screen

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.

CEF not working when running selenium tests in off-screen

Postby sergiofrrg » Thu Jul 14, 2016 8:04 am

Hi,

Part of my application uses CEF in off-screen-rendering mode to display some web pages. The idea was to test those pages with a Selenium Framework I've built but it doesn't seem to work.
In the last versions of CEF, it basically generates a runtime error that closes the application.. and in some previous version it does work but with problems (e.g. There is some kind of blocking between Selenium and CEF unabling Selenium to notice if the tests are failing or not).

Is it a CEF bug? or is something I'm missing?

Thank you!!
sergiofrrg
Newbie
 
Posts: 4
Joined: Thu Jul 14, 2016 7:27 am

Re: CEF not working when running selenium tests in off-scree

Postby magreenblatt » Thu Jul 14, 2016 9:31 am

What OS and CEF version? What is the error? How to reproduce?
magreenblatt
Site Admin
 
Posts: 12408
Joined: Fri May 29, 2009 6:57 pm

Re: CEF not working when running selenium tests in off-scree

Postby sergiofrrg » Fri Jul 15, 2016 2:13 am

My OS is W8.1 and the CEF version that causes the runtime error is 3.2704.1432. On the other hand, the CEF version that causes the blocking thing is 3.2556.1368 and my selenium version is 2.53.0

To reproduce the error you just must run an instante of Cefclient with --off-screen-rendering-enabled and --remote-debugging-port=xxxxx and then run the Selenium tests with the ChromeOptions (debuggerAddress) pointing to the specified port.
sergiofrrg
Newbie
 
Posts: 4
Joined: Thu Jul 14, 2016 7:27 am

Re: CEF not working when running selenium tests in off-scree

Postby magreenblatt » Fri Jul 15, 2016 10:43 am

How are you running Selenium? What is your test code that reproduces the problem?
magreenblatt
Site Admin
 
Posts: 12408
Joined: Fri May 29, 2009 6:57 pm

Re: CEF not working when running selenium tests in off-scree

Postby sergiofrrg » Mon Jul 18, 2016 2:15 am

Hi,

Since my project is a bit more complex than just a selenium project, I use gradle wrapper as my build tool. It's ready to run my tests in different browsers depending on some parameters. In the CEF case, I create the selenium driver this way:

Code: Select all
chromeCef {   
        driver = {
            ChromeOptions options = new ChromeOptions();
            options.setExperimentalOption("debuggerAddress", "127.0.0.1:22222");
            def driver = new ChromeDriver(options)
            driver
        }
    }


(Take in account that I'm using Groovy language here)

There is no specific test code to reproduce the problem, cause, it breaks at the very moment one test fails.

error.PNG
error.PNG (9.25 KiB) Viewed 5715 times


error2.PNG
error2.PNG (11.13 KiB) Viewed 5715 times


onionFalla.PNG
onionFalla.PNG (30.95 KiB) Viewed 5715 times


I am going to prepare a light version of my project with the necessary stuff to reproduce the problem in case you want to see the whole behaviour.
sergiofrrg
Newbie
 
Posts: 4
Joined: Thu Jul 14, 2016 7:27 am

Re: CEF not working when running selenium tests in off-scree

Postby magreenblatt » Mon Jul 18, 2016 10:08 am

What is the symbolized call stack for the crash? Download the debug symbols and place the PDB file next your executable, then attach Visual Studio when the application crashes.
magreenblatt
Site Admin
 
Posts: 12408
Joined: Fri May 29, 2009 6:57 pm

Re: CEF not working when running selenium tests in off-scree

Postby sergiofrrg » Tue Jul 19, 2016 5:57 am

There you go, It seems something is happening in the snapshot_aura.cc

pilaDatos.PNG
Call Stack
pilaDatos.PNG (37.44 KiB) Viewed 5698 times


Edit:

Hi, I've been doing some more researching and what I''ve found is that the layer of our project that doesn't seem to work correctly is the Geb layer.

Just in case you don't know, Geb is a library which encapsulates and puts together webdriver, jquery and other technologies in order to make working with selenium and page objects something easier: http://www.gebish.org/.

The thing is... this tool does use Selenium Webdriver, in fact, you define and configure what drivers you are going to use in the GebConfig.groovy file so... I don't get what can be happening...

If I create a normal Selenium project everything works fine.

In case you want to give it a try, here it is a good geb project.
[url]
https://github.com/geb/geb-example-maven[/url]


Update:

Problem detected: Basically what happens is that something is not working correctly when Selenium tries to take a screenshot from CEF in off-screen mode, why it was failing when using Geb?, well that was because it is internally implemented using that screenshot system.

I don't know if this helps you at all or if this is a Selenium problem or a CEF problem but... at least we figured out.

Thank you.
sergiofrrg
Newbie
 
Posts: 4
Joined: Thu Jul 14, 2016 7:27 am


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 50 guests