简体   繁体   English

Jenkins / Maven空指针使用自定义配置文件

[英]Jenkins/Maven nullpointer using custom profile

got a very strange error occurring - it seems when I try and set a custom firefox profile ( I need to disable the geolocate feature) and try to run tests in Jenkins I get null pointers. 发生了一个非常奇怪的错误-似乎当我尝试设置自定义firefox配置文件(我需要禁用geolocate功能)并尝试在Jenkins中运行测试时,我得到了空指针。 Using Eclipse and maven from the command line, I have no issues. 从命令行使用Eclipse和Maven,我没有任何问题。 The tests run with no failures due to this. 因此,测试运行不会失败。

The code I am using is: 我使用的代码是:

myprofile.setPreference("geo.enabled", false);
driver = new FirefoxDriver(myprofile);

The error (that led me to believe it's this) was: 错误(使我相信是这样)是:

googleHomePage(my.seleniumConfiguration.tests.GoogleDefaultTest)  Time elapsed: 0.49 sec  <<< ERROR!
java.lang.NullPointerException: null
    at my.company.steps.WebDriverSteps.<init>(WebDriverSteps.java:77)
    at my.seleniumConfiguration.tests.GoogleDefaultTest.setUp(GoogleDefaultTest.java:54)

Anyone had this before or have any ideas what I have done wrong? 有人以前有过这个吗,或者有任何想法我做错了什么?

I got this figured out - I hate NullPointers as isn't a lot to go on. 我明白了这一点-我讨厌NullPointers,因为没有什么可继续的。

Anyway, another topic (I can't find the link) basically said that when Firefox was launched from Jenkins it was using a user directory tied to Jenkins. 无论如何,另一个主题(我找不到链接)基本上说,当从Jenkins启动Firefox时,它使用的是与Jenkins绑定的用户目录。 So, I changed my code and created a user profile in a different location - pointed to that and, no error. 因此,我更改了代码,并在其他位置创建了用户个人资料-指出了这一点,并且没有错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM