I'm trying to test a Java web app using Selenium 2.16.1. When Selenium opens Firefox, I see a band at the top of the page with message "Will you help improve Mozilla Firefox"
For some reason this breaks
selenium.click("id=submit");
selenium.waitForPageToLoad("60000");
which is trying to log in - it becomes a no-op, and the test fails because it's then expecting to have logged in. If I break on the click line and clear the 'will you help' band before continuing then the form submit succeeds.
Is there a way to suppress this band from appearing? (I expect that would mean setting a property in Firefox's default profile - where do I find that?) Or is there a way to get Selenium to spot and dismiss this first? Thanks! I'm using Firefox 9.0.1.
Solved - thanks Danny! Just in case it isn't clear from the answers and comments below:
This was an issue with 2.16.1 and IMO the best solution is to upgrade to 2.17 or later.
Peter points out below that this question is highly ranked for the "Will you help" message itself. If you're looking to disable it:
Firefox 9/10+: http://developers.sugarcrm.com/wordpress/2012/01/23/howto-disable-the-mozilla-firefox-telemetry-feature/ (and please vote up Peter's answer)
Firefox 6-8/9 or earlier: https://wiki.mozilla.org/Security/Reviews/Firefox6/ReviewNotes/telemetry (please vote up Danny's answer)
This is the telemetry feature, and the prompt is controlled by the toolkit.telemetry.prompted property:
https://wiki.mozilla.org/Security/Reviews/Firefox6/ReviewNotes/telemetry
You can set it via prefs.js:
http://kb.mozillazine.org/Prefs.js_file
Also relevant:
http://code.google.com/p/selenium/issues/detail?id=3144
The link referenced by #Danny Thomas is now out of date (it only applies to Firefox 6/7/8).
To get rid of the prompt, add the following lines to prefs.js in your firefox user profile directory.
user_pref("toolkit.telemetry.enabled", false);
user_pref("toolkit.telemetry.prompted", 2);
user_pref("toolkit.telemetry.rejected", true);
Note that the prompted setting has changed from 'False' to '2'.
Note: This also applies to the Firefox ESR product (tested on 10.0.5).
Source : http://developers.sugarcrm.com/wordpress/2012/01/23/howto-disable-the-mozilla-firefox-telemetry-feature/
I found out a little workaround. Use:
WebDriver driver;
...
WebElement elem = driver.findElement(By.id("submit"));
elem.sendKeys(Keys.RETURN);
it's like hitting "Enter" after getting to the element with the Tab key.
Danny
I was also facing same problem.
Solution for this is Use latest Selenium Server jar file (selenium-server-standalone.jar).
So it will work properly with latest firefox version and at the top of the page "Will you help improve Mozilla Firefox" message will not be displayed.
Related
INTRO:
I am a student using Java Selenium for GUI testing. I cannot get test cases to run on my desktop but other members of my team are able to.
WHAT TECH/SOFTWARE IS BEING USED
We are using JDK 14, IntelliJ Community Edition, BitBucket for our repo, and JUnit 4.
WHAT AM I TESTING
I am testing a sample single page application. I add a task, use a date picker to add a date, and then I click the "Add Item" button. However the click to the button isn't registered and the task isn't added to the list. If I restart my computer the first #Test works but the second one fails to clear the cookies and the second #Test fails.
DETAILED VERSION:
I am coming from a Surface Book 2 to a Alienware R10 desktop. My team was able to pull the project and run all of the test cases with no problem. However, I was unable to. The same program works on my SB2 but not on the Alienware R10 (AMD 3900 Processor).
WHAT I HAVE TRIED:
I used both a locally stored Chrome Driver and I used Boni Garcia's
WebDriverManager.
The project is built using Maven so I have tried to use both
dependencies and also add the selenium files directly to my project
structure with no success.
I reformatted my new R10 and tried to install everything again. I
carefully added the JAVA_HOME and MAVEN_HOME to my system path.
I tried to use ChromeOptions after seeing some posts on SOF and none
of those worked either.
The QA dev who leads us tried to help me for about 40 minutes and
couldn't figure it out. He said the problem isn't with my IDE but it
is with the Chrome cookies. I will have to clear the cookies every
time I want to run a JUnit Selenium test. However, other members of
my team do not have to do this and this doesn't always work.
EXTRA DETAILS:
I got a new Alienware R10 with the AMD Ryzen 3900 chip. I have added
JAVA_HOME and MAVEN_HOME to my Path and environmental variables.
I may be adding to the project structure or dependencies incorrectly.
This is my first post so please let me know if I should format the
question better or if I left any important details out.
CONCLUSION
I am pretty worried I wanted to study and practice over the weekend but I have put a lot of time into fixing this. My next idea is to use Eclipse instead of IntelliJ and see if I can get it running there. Any advice here would be helpful.
EDIT
Eclipse is not working either and has the same problem. This tells me the problem is definitely not related to the IDE. It is likely a CPU or Browser related issue. I also tried using other drivers through the WebDriverManger dependency.
Upon further research it seems to register clicks and actually add to the Tasks if I add a few Thread.sleep() functions into my code instead of the ExpectedConditions and element visability. The problem may be stemming from using the ExpectedConditions API but again this is working for my teammates and not for me. Could this potentially be a AMD chipset issue?
The element visibility may be the wrong function to use here but it did work on my teammates machines so that is why I didn't try to look for an alternative there. The function we are using looks at the DOM tree and we may instead want to see the visibility on the browser instead. I had difficulty testing this out as I didn't have a laptop to work with.
I reformatted my old laptop so it could be sold since I had this new PC set up but I will use it to try another function to see if it brings a different result.
EDIT2:
Observation/Guess
I am going to guess the problem is with the AMD 3900 CPU. The Thread.sleep() changes the behaviour to at least click my 'Add Item' button. It still does fail the tests I put it through and the ExpectedConditions API still doesn't work.
I am going to be returning the Alienware R10 and going to get an intel CPU R10 or build my own PC.
This is just an educated guess based on the difference in the behavior seen between my and myteammates' machines they have intel I have AMD.
If you are facing a similar issue please confirm whether you are using AMD or Intel in this thread. It will help others as well. I'm sure there are work arounds but they did not work for me. I also tried using ChromeOptions to disable the GPU and a few other options.
However there was no success and unless there is a better answer I'm blaming the AMD 3900 CPU.
Thanks and please contribute to this thread if you are facing a similar issue or have found a better answer. Any speculation could be helpful too.
I agree with the QA on your team.
This is not IDE related. I would suspect that manipulating the DesiredCapabilities of the WebDriver would resolve this issue. Given that you are using the bonigarcia WebDriverManager dependency, I would recommend atleat attempting the code below to see if the WebDriver can be created properly.
public static void main(String[] args) {
WebDriverManager.chromedriver().setup();
DesiredCapabilities chromeDesiredCapabilities = DesiredCapabilities.chrome();
WebDriver webdriver = new ChromeDriver(chromeDesiredCapabilities)
}
I'm working with Selenium, Java and Browserstack. Usually I develop in MacOS and I improve the compatibility with the remote browser. I'm trying to execute the same test cases that are working properly in MacOS, into a Windows remote machine.
The problem appears when I let a form incomplete because and I have clicked on a Cancel button to back again to the previous page. In this scenario the default chrome alert appears:
I have tried the Chrome option:
options.addArguments("--disable-notifications");
Also:
options.addArguments("--disable-popup-blocking");
And with:
prefs.put("profile.default_content_settings.popups", 0);
I know I can use a condition in the cancel button associated to the system configuration, where the selenium code accept the alert, but I'm searching an option more cleaning and easy.
Do you know any other option, capability or whatever, that could block those pop-ups but not the others?
Thank you in advance.
EDIT NOTE
It is something related with Chrome pop-ups only.
Please try
prefs.put("profile.default_content_setting_values.notifications", 2);
I am writing automation code using Selenium Webdriver Java against an application for Point of Sales systems.
When the application opens up at first there is a modal dialog which appears for the user to select an item on. This modal appears no problem when testing manually. Until just recently it also appeared when running automation.
It no longer does. The behavior is different between manual and automated runs.
I'm running against Chrome and I've set the "disable-popup-blocking" option for the Chrome driver, but it doesn't seem to be helping.
The developers also have no idea what might have changed. I am at a loss and just looking for any thoughts about where to look for clues.
Thanks.
Let me try to address your query:
The behavior is different between manual and automated runs is factually incorrect statement until & unless you are controlling the WebDriver instance with arguments.
As you mentioned there is a modal dialog which significantly means that the code for the dialog is present in the DOM. Maybe it's within​ a frame which we have to find out.
"disable-popup-blocking" option for the Chrome - The purpose of this option have nothing to do with element present in the HTML DOM.
Amidst all the confusion, the best solution may be to take help of Selenium Builder & put an end to all guesses.
Let me know if this answers your question.
I made some Automation tests with Selenium working on chrome, but now when I tried them in IE11 I got this weird behaviour: I land in a Page with a Search Box and a Search Button, pretty standard, and when I either set(" ") or sendKeys(" ") to an input textbox, the page "moves" to the left as is it had broken, imagine the page in the center of the screen and suddenly the left margin would dissapear and the page would stretch to the left... Does anybody know what I'm talking about?
Any help please?
BTW I also tried doing some actions in other elements and they won't break the page, also clicking the textbox won't do the trick, it happens when I put text in it
Well, "sendKeys" is likely what we call a "native event" and so it depends highly on the implementation of the binary driver for IE. For example, Selenium only officially supports native events on Firefox up to version 31.0.6 and not versions 32+. IE11 is pretty new and also comes in different versions (since it auto-updates). So, if you need to do a sendKeys that is non-native (which is usually not necessary) then you can probably code one using a JavascriptExecutor object. Let us know if that works for you.
-- addendum --
The Selenium team would tell you that they didn't want to include the javascriptExecutor funtionality in Selenium, but it is scenarios like this where the executor capability shows its true value.
Using Selenium 2.45 and IE 9
Chrome and Firefox operate correctly within the Cross Browser tool but IE 9 is throwing this error. I have updated the Security Settings and Ensured all were Enabled and Set to the same security setting. I have also updated the Status bar to 100%. Not sure what to do at this point.
Image1
Image2
Image3
Security settings had to be set to 'Medium" not high or low. That solved it!
Thank you all for your help in the matter!
you should check or uncheck ALL "protection mode" checkers at your ie settings.