My Selenium Java test script runs on Firefox browser.
Recently, it has started failing on applications where 'Enhanced Tracking Protection' is turned on.
https://support.mozilla.org/en-US/kb/enhanced-tracking-protection-firefox-desktop
How can I disable/turn it off via Selenium Web Driver? Is there any preference or capability through which I can turn it off in the Firefox profile?
I'm using Selenium with PowerShell and I had the same issue.
This solution works for me
[OpenQA.Selenium.Firefox.FirefoxProfileManager]$ProfileManager= [OpenQA.Selenium.Firefox.FirefoxProfileManager]::new()
[OpenQA.Selenium.Firefox.FirefoxProfile]$FirefoxProfile = $ProfileManager.GetProfile($ProfileName)
$FirefoxProfile.SetPreference("pref.privacy.disable_button.tracking_protection_exceptions", $true)
Is it possible to use Nightwatch.js without installing Java? There are official Selenium JavaScript bindings (WebDriverJS, selenium-webdriver). Is there a reason Java is required?
I am catering to a JavaScript community so I am trying to run nightwatchjs locally without introducing Java myself. I am certain that if you run a remote Selenium Server, that remote instance has to have the Java server running to pass off commands to the remote browser-specific driver. E.g.: ChromeDriver.
That said, I was under the impression that one could connect a standard client directly to a standard WebDriver (ChromeDriver) locally without having to stage the Java selenium-server-standalone-2.xx.0.jar server. With nightwatchJS being the 1st client I have tried, it was very hard to find a configuration where that would work since all the documentation indicates what Nate Stone is saying above. All examples that I have seen indicate that the location of the selenium-server-standalone-2.xx.0.jar needs to be stipulated:
selenium": {
"start_process": true,
"server_path": "lib/selenium-server-standalone-2.53.0.jar",
"cli_args" : {
"webdriver.chrome.driver" : "/Users/greg.kedge/bin/chromedriver"
},
"log_path": "integration/log" }
He's what I can say: if you want nightwatch to start (and stop) the server for you for the duration of the tests ("start_process": true), it does seem to be necessary to run the Java server.
However, through much trial, if you want to start the ChromeDriver on your own on the command line, thereby having it up all the time, I can run the ChromeDriver without the Java Selenium standalone. CAVEAT: Only attempted on OS X so far... So, assuming ChromeDriver is in your $PATH:
% chromedriver --url-base=/wd/hub
Starting ChromeDriver 2.21.371459 (36d3d07f660ff2bc1bf28a75d1cdabed0983e7c4) on port 9515
Only local connections are allowed.
Now grab that port (9515) and update your nightwatch.json to dictate you want to use Chrome. I am setting the default, but you could set up a Chrome-specific environment. Remove the "selenium" block from your nightwatch.json altogether and now tell nightwatch where it can find a running server AND what type of browser that is serving:
"test_settings": {
"default": {
"launch_url": "http://localhost:8888/",
"selenium_host": "127.0.0.1",
"selenium_port": "9515",
"silent": true,
"firefox_profile": false,
"screenshots": {
"enabled": false,
"path": ""
},
"desiredCapabilities": {
"browserName": "chrome",
"javascriptEnabled": true,
"acceptSslCerts": true,
"__commentOut: chromeOptions" : {
"args" : ["start-fullscreen"]
}
},
}
}
Using it this way works for me; I can run nightwatch to drive Chrome without a Java Selenium standalone server in-play. Again, this is on OS X using a ChromeDriver that is always running. I can't figure out how to get nightwatch to manage starting/stopping the ChromeDriver without adding the Java Selenium standalone server to the mix.
There is now documentation on the official site on how to do it.
I had some trouble with the configuration, so I have created a sample repository with working code:
https://github.com/zeljkofilipin/mediawiki-nightwatch
Well Nightwatch.js runs it's tests against the Selenium server. The Selenium server is a Java-Servlet.
So to use Nightwatch.js you just "indirectly" need Java (it's not needed for Nightwatch.js, but for Selenium).
However you are able to use different languages as Selenium Client, since you are able to download different WebDriver Language bindings here
++++++++++++++++++EDIT++++++++++++++++++
Those WebDrivers/bindings are independent of Nightwatch.js. You can use these WebDrivers/bindings without a Selenium server, if your tests and your browser run on the same machine. In this case you do not need Java, since the WebDriver runs the tests directly against a browser (this is further detailed here)
Nightwatch.js on the other hand definitelly requires java, because it needs the "Selenium-Standalone-Server" which is written in Java. As far as I know there are no other implementations for other languages, which is why it's not possible to run it without java.
Nightwatch sends HTTP requests to the Selenium-Standalone-Server (here comes java) and the server creates a session with the browser.
So to sum up: No Java --> No "Selenium-Standalone-Server" --> No testing with Nightwatch.js
There is:
Specify in global.js file the following:
const chromedriver = require('chromedriver');
module.exports = {
before: function (cb) {
chromedriver.start();
cb();
},
after: function (cb) {
chromedriver.stop();
cb();
},
Go to nightwatch.conf.js specify the global path there
That way you selenium will be diverted via Chromedriver without you needing selenium on your machine.
Internet Explorer - version 9
Selenium - 2.42.2
language - JAVA
What steps will reproduce the problem?
1.Trigger a login test on windows VM on IE with the following capabalities:
InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS=true
InternetExplorerDriver.IGNORE_ZOOM_SETTING=true
InternetExplorerDriver.REQUIRE_WINDOW_FOCUS=true
InternetExplorerDriver.ENABLE_PERSISTENT_HOVERING=true
InternetExplorerDriver.NATIVE_EVENTS=false
InternetExplorerDriver.INITIAL_BROWSER_URL="https://***********.com
2.Minimise the VM and
3.Wait for the selenium script to run and then maximise the VM to check if the tests are running fine.
What is the expected output? What do you see instead?
Expected Output: The login to the application should be completed.
Instead, the test is stuck in the login page. The user-id and password is not entered.(The webdriver is unable to identify the element)
Selenium version:2.42.2
OS:Windows 7
Browser:Internet Explorer
Browser version:9
The tests are triggered from jenkins server remotely. The tests run fine when it is in the foreground, but fails if the VM or IE is minimised.
If you are able to change the Protected Mode settings for each zone to same value (details are here). Then don't set following capability -
InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS=true
And also try without setting following capabilities (make sure zoom level set to 100%) -
InternetExplorerDriver.IGNORE_ZOOM_SETTING=true
InternetExplorerDriver.REQUIRE_WINDOW_FOCUS=true
I have tried navigator.javaEnabled() and this works as expected in Firefox but in IE11 returns TRUE.How can i detect if Java is enabled on IE9,10,11??
I m using Selenium IE Webdriver.I want to delete "This is the initial page of webdriver server." from IEDriverServer.exe file of Selenium IE Webdriver. I opened the IEDriverServer.exe file in notepad++ and deleted that line from it and again add it in my classpath.But then i get this error:
org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
How can we do that.Please someone tell me.
You can't just edit an executable file like that. You have undoubtedly ruined the executable and now should redownload it from the Selenium site.
Regardless, this is expected behaviour. The IEDriver must have somewhere to go to begin with.
There is a setting that configures this URL called InitialBrowserURL. If this is not configured in your code, then the default is used.
Configure this to what you want. Most cases it can be configured to just go to the home page of your application.