CentOS, Jenkins, Firefox & Selenium GRID - UnableToCreateProfileException

We have Jenkins running headless on centOS vm and accessing it through an HTTP call on another computer.

I have a project to run UI Selenium Tests, everything works well except firefox. he complains that the profile is not on centOS vm, so he can redirect it to the Windows virtual machine for testing. Does anyone know how to get the latest and biggest firefox on centOS since yum only has 17 (without a CentOS VM head)? Also, where is the firefox profile stored on CentOS if I just want to view the current firefox profile on this virtual machine? Any other solution that I haven't thought about? Let me know if you need more information, jenkins error below:

org.openqa.selenium.firefox.UnableToCreateProfileException: Given model profile directory does not exist: C:\Users\Selenium\FirefoxDriver Build info: version: '2.31.0', revision: '1bd294d', time: '2013-02-27 20:52:59' System info: os.name: 'Linux', os.arch: 'amd64', os.version: '2.6.32-358.6.1.el6.x86_64', java.version: '1.7.0' Driver info: driver.version: unknown org.openqa.selenium.firefox.FirefoxProfile.verifyModel(FirefoxProfile.java:154) org.openqa.selenium.firefox.FirefoxProfile.<init>(FirefoxProfile.java:92) org.openqa.selenium.firefox.FirefoxProfile.<init>(FirefoxProfile.java:79) com.igt.sqes.automation.selenium.factories.WebDriverFactory.createWebDriver(Unknown Source) com.igt.sqes.automation.arcus.setup.ArcusTestSuiteSetup.setUp(Unknown Source) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:601) org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:80) org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:564) org.testng.internal.Invoker.invokeConfigurations(Invoker.java:213) org.testng.internal.Invoker.invokeConfigurations(Invoker.java:138) org.testng.SuiteRunner.privateRun(SuiteRunner.java:277) org.testng.SuiteRunner.run(SuiteRunner.java:240) org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86) org.testng.TestNG.runSuitesSequentially(TestNG.java:1198) org.testng.TestNG.runSuitesSequentially(TestNG.java:1194) org.testng.TestNG.runSuitesLocally(TestNG.java:1123) org.testng.TestNG.run(TestNG.java:1031) org.testng.TestNG.privateMain(TestNG.java:1338) org.testng.TestNG.main(TestNG.java:1307)

It works fine when starting from a Windows window, because the driver is in this place and can forward for testing vm.

+6
source share
2 answers

One way to make a Firefox profile available to CentOS VM for use on the Windows virtual machine that runs the Selnium node is to create a Windows share that points to the Firefox profile, and then install that resource on CentOS. Here are the steps I used to complete this work:

  • On Windows, create a share in the directory where the Firefox profile is located. By default, a Firefox profile is usually in the form C: \ Users \ username \ AppData \ Local \ Mozilla \ Firefox \ Profiles \ 427nha20.default. You can put a profile in a directory with limited rights, for example, with read-only privileges.
  • On CentOS, create a directory in the / mnt directory with the name you provided the Windows share. Names do not have to be the same, but it helps maintain consistency.
  • On CentOS, add the following line to the / etc / fstab file: // windowsVMIP / windowsShareName / mnt / windowsShareName cifs username = windowsUser, password = windowsPassword, uid = 123, gid = 123, _netdev, ro 0 0
  • windowsVMIP is the IP address of the shared machine virtual machine; windowsShareName is the name of the Windows shared folder; / mnt / windowsShareName is the name that you pointed to the Windows share; username and password are credentials for a Windows user; uid is the user identifier in CentOS; gid is the main group identifier in CentOS (you can get uid and gid by running grep jenkins / etc / passwd. These are the 3rd and 4th attributes, respectively);
  • On CentOS, manually copy Windows sharing by doing the following: mount -t cifs -o username = windowsUser, password = windowsPassword, uid = 123, gid = 123 // windowsVMIP / windowsShareName / mnt / windowsShareName
  • cd to / mnt / windowsShare and ls to verify that the mount is complete
  • Configure the Selenium Firefox driver by installing the FirefoxDriver.PROFILE function on the CentOS installation resource. Then pass on the features of Selenium Webdriver when you create it. For example, in Java:

    FirefoxProfile profile = new FirefoxProfile(new File("/mnt/windowsShareName")); DesiredCapabilities capabilities = DesiredCapabilities.firefox(); capabilities.setCapability(FirefoxDriver.PROFILE, profile);
    WebDriver driver = new RemoteWebDriver(new URL(gridHubURL), capabilities);

  • The Firefox profile will be sent from the CentOS share and redirected to the Windows VM Selenium node after creating the Selenium driver instance.

0
source

1. Try installing a newer version of Firefox

You can use the Remi repository for this.

 ## Remi Dependency on CentOS 6 and Red Hat (RHEL) 6 ## rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm ## CentOS 6 and Red Hat (RHEL) 6 ## rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm 

Step-by-step instruction

2. Try to copy the existing profile and specify it explicitly

See the next section: CentOS Selenium - Firefox Profile Preparation

+2
source

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


All Articles