right I have hit a wall using the Selenium Maven Plugin - using the selenese goal which is all swell - however when it comes to executing the tests in firefox, the plugin launches a fresh firefox profile, which doesn't have the company proxy configured.
Now if i were simply executing my html suite directly with the selenium server jar I could specify a firefox profile - however it appears to be the case this has not been included in as a parameter in the selenese goal for this plugin. madness!
there are such parameters for the start-server goal, so why not selenese?
Has anybody else faced this issue? Any workarounds?
Appreciate all sensible input.
Thanks,
I thought I would post my solution should anyone else come accross this...
Simply need to get the selenium maven plugin source, and patch it. The constants are available in the selenium server RemoteControlConfiguration class however this plugin doesn't make use of them all in the SeleneseMojo. So it is a very simple fix:
Set the properties that we want to change when the seleneseMojo starts the selenium server. So in this case I wanted to make use of firefoxProfileTemplate so I did this:
def conf = new RemoteControlConfiguration()
conf.port = port
conf.singleWindow = !multiWindow
conf.firefoxProfileTemplate = firefoxProfileTemplate
def server = new SeleniumServer(slowResources, conf)
server.start()
Now I can specify a firefoxProfileTemplate value in my maven project execution configurations and therefore specify a firefox profile when running selenium html suites through maven.
Related
My setup is:
Selenide
Junit5
gradle
I using parametrized tests to run same tests with different users.
On top of that, I want to add BrowserStack.
So eg. having test
#ParameterizedTest(name = "{index}; user: {0}")
#ArgumentsSource(...)
public void exampleTest(TestUser user) {
I want to end up with, eg.
(0) exampleTest; user 1; Firefox
(1) exampleTest; user 2; Firefox
(2) exampleTest; user 1; Chrome
(3) exampleTest; user 2; Chrome
Problem is that BrowserStack example for junit5 is (a) written for plain selenium, not selenide and (b) doesn't seem to work with ParameterizedTest.
Have anyone attempted such setup, and can point be to right direction? I don't want to reinvent the wheel if I can use out-of-the-box solution ;)
I'm also open to use SauceLabs instead of Browserstack.
I think, a good approach is to isolate your test domains
Browsers switching in test runtime is not good solution since Selenide has static configuration
You have to split test configuring and test running
1 part - your configuration domain: external browsers configuration (you can implement this approach via JUnit5 extensions) Example - JUnit5 extension that configure your test libs (Selenide, etc) according to some external env variable
2 part - your test domain - parameterized tests via your test data (users, conditions, etc)
I think you can use the Official Browserstack documentation for running the Selenide test parallel on various browsers.
https://www.browserstack.com/docs/automate/selenium/getting-started/java/selenide/run-tests-in-parallel
https://www.browserstack.com/docs/automate/selenium/getting-started/java/selenide#introduction
Also, you can take help from their GitHub Repository for Selenide with TestNG, where they have used #parameters with their test cases.
https://github.com/browserstack/selenide-browserstack.git
I hope this helps.
Thanks
I'm using SonarQube 8.1 (Developer Edition) and Jenkins to analyse Maven projects which source code is hosted on Bitbucket.
I'm using the "Pull Request Decoration" functionality and it's working well. However, to configure this functionality, I had to set these parameters manually (through the GUI, in project page : Administration > General Settings > Pull Request Decoration) :
Configuration name
Project key
Repository SLUG
Is it possible to set these parameters through command line (e.g in mvn command, I'd expect something like mvn clean -Psonar $SONAR_MAVEN_GOAL -Dsonar.pullrequest.decoration.configurationname=<my-conf-name> -Dsonar.pullrequest.decoration.projectkey=<my-project-key> -Dsonar.pullrequest.decoration.repositoryslug=<my-repository-slug>) or throught REST API ?
Get an answer here : https://community.sonarsource.com/t/sonarqube-configure-pull-request-decoration-with-parameters/18999
No, this is not possible to define this from the scanner. Thoses are
project-level parameters, they won’t change from one analysis to the
next one, so better not pollute your scanner with static parameters.
You can indeed define them with the rest API. Have a look at the
api/alm_settings/set_bitbucket_binding entry in your web api
documentation!
I have created a selenium 2 automation framework, using maven have packaged it into a WAR file.
After deploying build, when i start am getting my landing jsp, its a simple one, with a button as StartRun, on click of that i have initiated creation of WebDriver instance (am using ChromeDriver) and navigation to a specific URL.
But when i click on the button nothing happens,i have enabled log4j to capture all actions, so from logs i could see ChromeDriver instance is created, but am not able to see Chrome window opening up.
Am using selenium-2.44.0 and language is Java
Here is the piece of code where ChromeDriver instance is created :
System.setProperty("webdriver.chrome.driver", "C://chromedriver.exe");
WebDriver driver = new ChromeDriver();
captureLogs.info("Opening browser");
try {
objectForTest(driver);
}
Any help would be much appreciated, happy to share more details if required.
Basically I'm trying out Selenium webdriver (using FireFox) and right now I am trying to sign up to a Google account.
However, the strange thing is that whenever I run Selenium and let it use the (empty I assume?) Selenium FireFox profile Google seems to detect it and block me (asking for phone vertification).
This is even the case when I load up the selenium profile and manually sign up.
When I sign up manually (and don't use the selenium profile) I can sign up just fine.
Is the Selenium FireFox profile some how special which enables the servers to detect it?
EDIT: I'm trying to startup selenium with my default FF profile (however it keeps starting up in an empty profile) - here's the code:
OpenQA.Selenium.Proxy proxySetting = new OpenQA.Selenium.Proxy();
proxySetting.HttpProxy = proxy;
proxySetting.FtpProxy = proxy;
proxySetting.SslProxy = proxy;
FirefoxProfile profile = new FirefoxProfile("default");
profile.SetProxyPreferences(proxySetting);
profile.SetPreference("browser.privatebrowsing.autostart", true);
_driver = new FirefoxDriver(profile);
EDIT:
I managed to open the default firefox profile but now it doesn't use my proxy settings. How can I use the normal profile and still customize the profile proxies?
This post talks about an HtmlDriver tag being added to the HTML in the FirefoxDriver which would be a dead giveaway
Google is a strong supporter of Open Source, and even Selenium itself, however I don't think Google would particularly condone a Selenium script creating a bunch of spam accounts that probably would never be used, and just take space.
That being said, I believe that it would be possible potentially.
The only way that Google would be able to know you are using Selenium, is based on the Request Headers. It's possible either the User-Agent has something to do with Selenium, or one of the other Headers.
My solution would be to use something like Fiddler to listen to the requests that Firefox is sending, and then edit your Selenium scripts to account for, and change those requests so Google does not know that you are using Selenium.
This most likely goes against their terms of use, so exercise caution, and use this answer for educational purposes only.
Is there a chance, if you were using the complete path to your firefox profile directory? (e.g. C:\Users\???\AppData\Roaming\Mozilla\Firefox\Profiles\your_profile.default)
I'm trying to run tests with a custom firefox profile.my idea is to
use 2 firefox versions in my machine .one with firefox template &
other without it ,so we used
*custom "C:/Program Files (x86)/UtiluMFC/Mozilla Firefox 3.6/
firefox.exe" in setup from code
if i use custom some extra parameters are passing in url like below in
browser ,
selenium-server/core/RemoteRunner.html?
sessionId=dc91ae43b4754f87a25d4718feeb&multiWindow=true&baseUrl=http%3A
%2F%2Ftest.com&debugMode=false
Note : i have not started the server from command prompt i have used
in java ,but havnt set any firefox template in code.same worked in
linux of i use * firefox instead of * custom
Am i missing some thing?
The question is not that clear - what do you mean by template?
If you want to run with two different Firefox profiles, don't use *custom - rather use *firefox and change the profile as per this post:
Selenium RC : Setting up a Firefox proxy
I think I am strougling with the same and I believe one has to set the proxy settings in the custom firefox to make it work. Did you try that?
Or did you just want to use a profile TEMPLATE in which case you could pass the -firefoxProfileTemplate in your command to start the JAVA server, like so:
java -jar selenium-server.jar -firefoxProfileTemplate "/path/to/profile/"
In the second case, if you use *firefox, your profile will automatically be selected.