Selenium IE - No Such Window Exception (Debugging is working however) - java

as per the title, I am using Selenium 2.45.0 WebDriver and trying to run some tests in IE11 with Win7 Pro. I have used these in Firefox and all works well.
The issue I am having is that shortly after the IE window is opened, Selenium looses track if it. I have searched and found the registry key and tried the security settings.
Here's where it gets odd. If I run this in Debug, it works. No issues. Just works. I also, for a time, thought the firewall was blocking stuff as things passed the first time it ran ( an allow access window appeared) however after allowing access the tests fail.
Anyone have any extra ideas?

I managed to get this working. Initially, I had saw Issue 6511 on the selenium group and had set my registry key for the 32 bit version of IE - however according to the issue, I should have set my registry key based on the version of windows. So
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BFCACHE - added a DWORD called "iexplore.exe" and set it be 0.

Related

Java Selenium Potential Chrome Cookies, Driver, ExpectedConditions API Issue?

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)
}

Selenium has a problem finding element at lower window size (DOM doesn't change)

little introduction:
I'm using Selenium webdriver for Java to run some Tests. I got a Monitor with FullHD resolution (1920x1080) and a UWQHD Monitor (3440x1440). Normally i run selenium via chromedriver with headless as chrome param (which works fine so far). But if I want to develop or debug some Selenium paths, I use it without headless (of course).
Chromedriver Version: 77
Chrome Version: 78.0.3904.97
the Problem:
If I run the application without headless param on my fullHD Monitor selenium fails to find elements. If I run it on my UWQHD Monitor with a higher window size like 2500x1200 it works. The DOM really doesnt change between these window sizes. Also I can't set a higher window size then the current resolution of the monitor via:
this.driver.manage().window().setSize(new Dimension(2500,1500));
Do you guys have any idea? I thought the window size is only important for the different DOMs.
Even If I track the selenium paths at a lower window size it won't work.
regards,
bierat
The Problem was that there was an sticky header which overlapped the element I wanted to be clicked.
So I set an offset to fix that issue and that solved it.
Thanks to Volokh for his hint!

Strange crash opening Firefox (only on work machine)

I've got a little test suite working on my laptop which I've tried to transfer over to my work desktop. To, hopefully, make things easier, I used the same version of Java and maven. However, typically, it's not been so easy :)
When I started Firefox, I got a "Firefox has stopped working" message box. The message box indicated the issue lay with "xul.dll" - so I closed the box and Firefox opened. It does this everytime I open Firefox.
I have even stripped out all my allure and other code and just ran a simple case:
WebDriver driver = new FirefoxDriver();
driver.get("http://www.google.co.uk");
However this doesn't work either.
It was then I checked the versions of Firefox were the same, turns out they weren't - but the Firefox updated fixed that. But my test still passes on the laptop, but fails on the desktop. I can't see anything I have missed, I can see one possible issue - the work desktop has Kaspersky installed.
Has anyone ever experienced what I've described?
I have also observed that antivirus causes the Firefox to hang during the launch. Try disabling the antivirus and rerun your script to verify that in your case also the antivirus/firewall is causing the issue.
Check the version of Firefox on both computers. I have two Windows machines with Selenium 2.45.0. One machine has Firefox 37.0.2 and the code below executes fine. The other machine I just updated to Firefox 38.0.1 and I receive that error message box.
#Test
public void testFirefoxDriver() throws Throwable
{
new FirefoxDriver();
}
I've been using Selenium for over a year now. Our production server automatically updates Firefox and this occasionally causes incompatibilities between Firefox and Selenium. I would expect to see a new Selenium release very soon.
Firefox 38.x is not supported by Selenium 2.45.1. Either you have to roll back your firefox to 37.x or wait until next revision of Selenium.
https://github.com/SeleniumHQ/selenium/issues/437
I've got this same issue. Funnily enough it was working yesterday morning I started getting it yesterday afternoon and now it appears to be messing up my tests.
I have Selenium 2.45.0 & Firefox 38.0.1.
My tests were running perfectly before this started happening and nothing has changed in my code. I've also ran another test suite just to make sure that it wasn't the one I was working on. The same thing happened.
I've just uninstalled firefox downloaded the previous version and they now work again with no crash.

Issues with Java 7u65

Last night a new Java 7 update has been released: 7u65. I have a web application where a service applet is loaded, and after the update, my tests on different PCs did not show issues nor wrong behaviors.
Later, I started to receive issue reports related to my product's Java service applet. All the reports came from users who updated Java JRE to 7u65 (from 7u60):
The applet was not loading at all. I display a "Loading" screen when the application starts, and this was not being displayed. Also, all the services provided by my Java applet were unavailable.
After changing the Java Control Panel's advanced configuration to always show the console (in one of the PCs where this issue happened), I discovered that the applet was not even launching the Java console.
Using the same station where the error happens, trying to access java.com to check the current java version, the Java applet is loaded and the console is displayed without errors.
All tests were performed after clearing Browser and Java Cache, and even after removing the installed certificates (mine is a valid signed applet).
I checked the Java 7u65 release notes and none of the mentioned changes seem to affect my applet. Also, there were no issues while using Java 7u60.
I don't have any clues about what is going on, perhaps because the java update was released hours ago. As the Java console can not be displayed even if I configure Java Control Panel to do so, I can not tell if there is any exception. I can not reproduce the issue in my PCs (Windows 8, nor Windows 7, both at 64 bits), but the issue has been reported on Windows 7 PCs.
One of my friends told me that this seems to be happening on machines where Java 7u60 was in use, and then it was updated to Java 7u65 with no deinstallations. Also, this tends to happen in older OS (ie: WinXP) which is more natural.
I write this question because it seems very odd that some PCs have this issue, and some others not. I'd like to know if any one else is having this issue, knows what could be the reason, or has discovered/applied any solution to it. Also, I'd like to share the solution if I ever happen to find it.
Thanks.
Edit:
External references, related to the same Java version (JRE).
Internet Explorer crashing after updated Java to 7u65: An issue with the same JRE version, this time with Internet Explorer and Firefox.
RS Loading Issue (Java) ~ READ: An issue related to the same JRE version update, this time, in a Java Game.
The future of Java on Windows XP:
This end of support announcement has been misread as "Java no longer works on Windows XP" or "Oracle will stop Java updates from being applied on Windows XP". These statements are not correct.
I just ran into this exact problem with one of my applets.
It looks like some changes were made to the handling of the 'java-vm-args' and 'java_arguments' params in 7u65.
'java_arguments' seems to no longer work, when it is specified, my applet will silently fail without even launching the JVM.
I have had the same problem.
I delete C:\Users\${USER}\AppData\LocalLow\Sun
When i reloaded the web page containg the appelets. The JRE recreated this folder again.
And evrything was OK.
There is no big difference between the folders contents .. but it worked.
It seems to be a bug in the jRE
It seems that oracle has changed something with processing default plugin java arguments,
that caused problem in new java.
When upgrading from older version of java it is possible that value for
deployment.javaws.jre.0.args (or deployment.javaws.jre.1.args)
is not defined in
C:\Users\${USER}\AppData\LocalLow\Sun\Java\Deployment\deployment.properties
If you add
deployment.javaws.jre.0.args=
to deployment.properties, applet will work.
It can be done through Java Control panel also:
Java -> View -> double click on Runtime Parameters cell for java 7u65 to enter edit mode -> OK -> Apply
java-jvm-args solution didn't work for me, applet was launched but arguments were ignored.
Oracle has released an update that resolves this specific issue via version 7u67
http://www.oracle.com/technetwork/java/javase/7u67-relnotes-2251330.html
As Miloš Ratković wrote, if customer hasn't string in deployment.properties
deployment.javaws.jre.X.args=
where x is number of java installation for version 7_65 (number of java installation for particular version is X in string deployment.javaws.jre.X.product=1.7.0_65), Java applet failed to start.
For my case I have a solution - don't pass any arguments for my applet.
In my javascript code for starting applet I'm just comment
<param name="java_arguments" value="some arguments">
string
Also, if you delete the directory C:\Users\${USER}\AppData\LocalLow\Sun, during next startup of java applet java write new deployment.properties with correct java args string
Uninstall java 7 update 65 and reinstall java 7 update 55 Download the windows x86 offline version
Go to Java control panel and uncheck: automatic update
When the next window comes up, click on "do not check"
then click on "apply" and "ok"
close all browsers and reopen them to continue your work
This has worked for me every time so far and I have been doing this for the last two weeks now with "0" issues.
Sorry, this is not the answer. I was trying to verify the feedback about JRE 7u65 not able to accept "java_arguments"; however, I setup a Windows x32 and installed (new) 7u65 without upgrade from any older version. With the "java_arguments", the machine is able to load the applet in IE8 and FF30, when few specific PCs do fail the same applet with upgraded u65.

Stop Chrome from trying to always update Java and Silverlight when running applets/plugins?

We have recently added a Silverlight based plugin (Plupload) that works great except for one issue:
If you try to use it in Chrome your browser will popup with the message "Silverlight was blocked because it is out of date".
I appreciate Google trying to force users to update (which they otherwise never ever do) but this has single handedly tripled our customer support load. Does anybody know of a way to force it to run in Chrome via Javascript/Html code?
We have seen the same issue with many sites using Java applets. As Oracle constantly has minor updates it seems near impossible to stay "up to date" so effectively you asked to upgrade 9/10 times.

Categories