Headless Selenium Test with Xvfb

I need to run selenium tests in headless mode using Xvfb, in pom.xml I have:

<plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>selenium-maven-plugin</artifactId> <version>1.1</version> <executions> <execution> <id>xvfb</id> <phase>pre-integration-test</phase> <goals> <goal>xvfb</goal> </goals> <!-- <configuration> <display>:2</display> </configuration> --> </execution> <execution> <id>selenium</id> <phase>pre-integration-test</phase> <goals> <goal>start-server</goal> </goals> <configuration> <background>true</background> </configuration> </execution> </executions> </plugin> 

when i run mvn integration-test, it failed to load Xvfb, selenium tests were still running in firefox, I checked the following:

 (EE) AIGLX error: dlopen of /usr/X11/lib/dri/swrast_dri.so failed (dlopen(/usr/X11/lib/dri/swrast_dri.so, 5): image not found) (EE) GLX: could not load software renderer (EE) XKB: Couldn't open rules file /usr/X11/share/X11/xkb/rules/base (EE) XKB: No components provided for device Virtual core keyboard 

Does anyone know what that means? Thanks.

+8
selenium
source share
3 answers

Adding a GLX extension to your Xvfb command line may remove the first two errors.

+6
source share

I found that my installation did not have mesa drivers.

 yum install mesa-dri-drivers 

solved the problem.

+4
source share

On Debian / Ubuntu, the package is "libgl1-mesa-dri", as in:

 apt-get install libgl1-mesa-dri 
+3
source share

Source: https://habr.com/ru/post/650913/


All Articles