首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >centOS、Jenkins、Firefox和Selenium网格-- UnableToCreateProfileException

问centOS、Jenkins、Firefox和Selenium网格-- UnableToCreateProfileException
EN

Stack Overflow用户
提问于 2013-06-20 02:38:04
回答 2查看 1.9K关注 0票数 6

我们让Jenkins在一台centOS虚拟机上运行headless,并在另一台计算机上通过http调用访问它。

我有一个运行UI Selenium测试的项目,除了firefox之外,所有的都运行得很好。它抱怨配置文件不在centOS vm上,因此可以将其转发到windows VM进行测试。有谁知道如何在centOS上获得最新和最好的火狐,因为百胜只有17个(无头CentOS VM)?另外,如果我只想在该虚拟机上scp当前的火狐配置文件,那么火狐配置文件存储在CentOS操作系统上的什么位置?还有其他我没有想到的解决方案吗?如果需要更多信息,告诉我,jenkins错误如下:

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)

当从windows机器运行时,它工作得很好,因为驱动程序在那个位置,可以转发到测试vm。

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2013-09-13 05:12:39

使火狐配置文件可供Windows在运行Selnium节点的Windows上使用的一种方法是在CentOS上创建一个指向火狐配置文件的共享,然后将该共享挂载到CentOS上。下面是我用来实现这一点的步骤:

  1. 在Windows上,创建火狐配置文件所在目录的共享。默认的火狐配置文件通常位于类似于C:\Users\username\AppData\Local\Mozilla\Firefox\Profiles\427nha20.default.的位置您可能希望将配置文件放在权限受限的目录中,例如具有只读权限的目录。在CentOS上的
  2. 中,使用您为CentOS共享指定的名称在/mnt目录中创建一个目录。名称不必相同,但有助于保持一致。
  3. 在CentOS上,将以下行添加到/etc/fstab文件中: //windowsVMIP/windowsShareName /mnt/windowsShareName cifs username=windowsUser,password=windowsPassword,uid=123,gid=123,_netdev,ro 0 0
  4. windowsVMIP是包含共享的虚拟机的IP;windowsShareName是Windows共享的名称;/mnt/windowsShareName是您为Windows共享指定的名称;用户名和密码是Windows用户的凭据;uid是CentOS上的用户ID;gid是CentOS上的主组ID (您可以通过执行grep jenkins /etc/passwd获得uid和gid。它们分别是第三个和第四个属性);
  5. 在CentOS中,通过执行以下命令手动挂载-t共享: mount cifs -o username=windowsUser,password=windowsPassword,uid=123,gid=123 //windowsVMIP/windowsShareName to /mnt/windowsShare和ls通过设置FirefoxDriver.PROFILE功能以指向CentOS挂载的共享,以确保挂载到Selenium Firefox驱动程序。然后,在创建Selenium Webdriver时将功能传递给Selenium Webdriver。例如在Java中:

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

在Selenium驱动程序为instantiated.之后,Windows配置文件将来自CentOS共享并转发到Windows节点

票数 0
EN

Stack Overflow用户

发布于 2013-08-14 18:31:39

火狐1.尝试安装更新版本的

为了做到这一点,你可以使用Remi仓库

代码语言:javascript
复制
## 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.尝试复制现有配置文件并将其显式指定为

请查看以下线程:CentOS Selenium - Preparing firefox profile

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/17198837

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档