Cannot determine loading status in Google Maps - selenium

I had a test written in Java and Selenium that basically does a search for a provider. It then clicks on the provider's Map This Location link and opens a google map. I would wait for an xpath visibility for that map after switching to the new window.
The URL would be something like
https://www.google.com/maps/dir//945+N+12th+St,+Milwaukee,+WI+53233/#43.0426642,-87.9297109,17z/data=!4m8!4m7!1m0!1m5!1m1!1s0x88051979232b79cd:0x905e19b746c46eb3!2m2!1d-87.9275222!2d43.0426642
This has been working fine for a year. Today we got updated to Chrome version Version 74.0.3729.108 (Official Build) (64-bit) so we replaced our old Chromedriver (which was now giving us an error that the Chrome version had to be between 70 and 73) with 74.0.3729.6 which our head developer downloaded from the site.
The problem is, now, and only for certain addresses, I get that error
unknown error: cannot determine loading status from no such execution context
Some Stack Overflow items suggested
1. Updating the Chrome Driver
2. Using a longer timeout
as you can see from above we updated our chromedriver to be consistent with the version of Chrome. I also updated the timeout to 300 seconds (5 minutes), but all in vain.
I am out of ideas about what else could be causing the problem. The xpath I waited for was //div[#aria-label='Map'] but I have tried other xpaths now too, such as "//div[#id='streetviewcard']". I verified that the window I switched to was driver.getWindowHandles().get(1). I had saved the original handle so I could switch back. I looked at all the window handles, and there were only 2, the original one and the one I switched to.
No other searches come up with anything useful.

I had exactly the same error, moving to v74.
Something must have changed with chromedriver, or chrome - I assume that when a new tab is opened, execution continues sooner than it did before. It's hard to tell what's actually changed, but ultimately I fixed our issues with a sleep:
Also, it's worth noting that getWindowHandles() returns in an undefined order - so might need some extra handling depending on your use case.
https://github.com/dvsa/mot-automated-testsuite/compare/ops-OPSTEAM-2827-selenium#diff-1fa0893dd1ad67d9c1a4ee1e777c20cb

Related

use selenium driver for fetching multiple pages in parallel

Can you "get" multiple pages in parallel with chromedriver?
I am using Python, and as far as I understand selenium provides windowing API but does not allow opening a new window for a new driver.get() action. Trying to fetch a page while another is in process has proven problematic for me although I guess it might have been my wrong usage.
Currently I am opening a number of chromedriver sessions in parallel, which in turn results with X 5 times chrome processes open - This can get intimidating although it seems to work. I am just wandering now if calling driver.get(url) on an existing session (after a previous page was retrieved) might open extra tabs/windows in the "internal" chrome process and bloat memory?
You can open links in a new window using selenium by forcing a context click:
A couple suggestions:
https://stackoverflow.com/a/19152396/1387701
https://stackoverflow.com/a/45582818/1387701
You can then use the switch_to command to switch between these windows.
See more at https://www.browserstack.com/guide/how-to-switch-tabs-in-selenium-python

C# Selenium WebDriver Hangs on same page

No matter if I do a FindElement. Or on the Wait.Until.
var wait = new WebDriverWait(Driver.Instance, TimeSpan.FromSeconds(10));
wait.Until(d => d.Title == pageTitle);
I get the following error:
OpenQA.Selenium.Remote.RemoteWebdriver.Title.Get timed out and needed to be apborted in an unsafe way. This may have corrupted the target process.
It says one way to fix it is to click on the 'enable property evaluation and other implicit function calls'...but that doesn't help. Just hangs and gives me a less detailed message. What could cause the hangup on Just trying to get the Title of a page? I need help to look in a new/correct direction, so far I have been hitting dead ends.
Chrome -- Version 76.0.3809.100
Selenium.WebDriver.ChromeDriver version 76.03770.....going to upgrade this one...to be closer
Giving Credit where Credit is due....I thought I had these synced up..... I did not..from one greg to another...thank you.
Usually these things are the result of a mismatch between the web driver version and the version of the browser you are interacting with. – Greg Burghardt

Selenium RC - t.replace is not a function

[edit for godman] I am working on a web based application, written in PHP. I am using Selenium RC to run tests on the webpages produced by this application, through a browser.
I just upgraded to Firefox 14, so I had to upgrade to Selenium RC 2.25.0.
Now I'm seeing this error when running a test with htmlSuite:
Command execution failure. Please search the user group at
https://groups.google.com/forum/#!forum/selenium-users for error
details from the log window. The error message is: t.replace is not a
function
The command executed is:
clickAndWait //a[text()='! selenium test customer']
As you can see, it's not doing anything too tricky - just clicking a link. The test runs fine in the IDE, it's just when run via RC that it's a problem.
Searching in the groups revealed only really old threads dating back to version 1 of selenium.
Any ideas anyone?
[edit] I've been running the test that has these problems several times a day for the last week - and it doesn't seem to fail like this every time. This looks like it's a random problem. Has anyone seen this happen before?
[edit after the bounty got me no answers] Another example of it failing is with:
clickAndWait css=a.edit_company
This same call works fine earlier in the same test, on the same page.
[edit] Now I'm seeing the same error with a completely separate command:
type id=Address1 Address1
Does anyone have any suggestions about this? Any way I can even debug what's going on (I don't see this in the IDE at all)
I am not terribly familiar with clickAndWait. I personally prefer clicking and then doing my own custom waiting.
Try just clicking and add a Thread.Sleep(5000), or something similar, and see if the error is a result of the click or the wait part.
If it is the wait part, then I have a different suggestion than if it is the click part.
I've seen similar issues across various platforms. It has always been somewhat random for me, so I don't use clickandWait. Generally is is much more reliable to do a plain click, and then wait for specific condition. You could do a waitforpageload, but that has also been unreliable for me so I prefer things like waitfortextpresent and waitforelementpresent.
Usually, this kind of error would occur if you are dealing with something that is not a string. Could you just make sure that you are dealing with strings only?
2 possibilities where it is arising from:-
When text() is executed -> it might be dealing with a non-string
a[expression] -> the expression(text() = '! selenium test customer') when evaluated to False/True might be the problem because if a is a Map/array, the corresponding key should be a string and not a bool, probably.
text()='! selenium test customer' -->> is it an assignment operation? if yes, make sure that text() returns a lvalue or a mutable object (based on the language you are using selenium rc with)

Selenium 2: getScreenshotAs() mixed up when running several tests in parallel

in a continuous integration build environment when running several Selenium tests in parallel (using Firefox driver) for different applications and each tests records its screenshots after every "action" (e.g. navigating to a page, submitting a form etc.) it seems like that whichever application window pops up that one gets on the top of the z-axis and will have the focus.
So using the method getScreenshotAs() from the Selenium API to record images results in mixed up screenshots sometimes showing one application and sometimes the other application.
Recording the HTML responses with getPageSource() on the other hand seems to work correctly using the Firefox driver instance "bound" to the test.
Is there any solution how to deal with the mixed up image screenshots? Is there a possibility how to ensure that getScreenshotAs() only consideres its own Firefox driver instance? Thanks for any hints!
Peter
I don't know what flavor of selenium you are using but here is a reference to the API that looks like it would fix your problem, but I have never tested it.
http://selenium.googlecode.com/svn/trunk/docs/api/dotnet/index.html
What that link shows is the IWrapDriver which according to the documentation Gets the IWebDriver used to find this element.
So from my understanding you could set your IWebDriver in your method and then wrapit with the IWrapDriver and then use that to reference for you getScreenShotAs();

Selenium RC drops error when it tries open the popup

When selenium tries to open popup window I'm getting JS error permission denied in file
file:///C:/DOCUME~1//LOCALS~1/Temp/customProfileDir8708f7f69e14482ba857f4b2e74775c1/core/RemoteRunner.hta
So this break script execution, could you assist? I saw a related topic at MSDN and openqa but didn't find resolution that could help me.
I've just encountered this error. In the end it was because I was running IE in 'Offline' mode. Open the File menu and make sure that "Work Offline" does not have a tick next to it.
I've just updated a section about that in the Selenium docs. The website build is not working right now, so if you go to the site you will find the old version.
I'll paste the raw text here, I think your case is the second: JS trying to access sections that are still not loaded, so your solution would be a waitForPopUp command:
Why am I getting a permission denied
error?
The most common reason for this error
is that your session is attempting to
violate the same-origin policy by
crossing domain boundaries (e.g.,
accesses a page from http://domain1
and then accesses a page from
http://domain2) or switching protocols
(moving from http://domainX to
https://domainX). For this to be
solved, try using the Heightened
Privileges Browsers if you're working
with the Proxy Injection browsers.
This is covered in some detail in the
tutorial. Make sure you read the
sections about The Same Origin Policy
and Proxy Injection carefully.
If the previous situation was not your
case, it can also occur when
JavaScript attempts to look at
objects which are not yet available
(before the page has completely
loaded), or tries to look at objects
which are no longer available (after
the page has started to be unloaded).
This is most typically encountered
with AJAX pages which are working with
sections of a page or subframes that
load and/or reload independently of
the larger page. For this type of
problem, it is common that the error
is intermittent. Often it is
impossible to reproduce the problem
with a debugger because the trouble
stems from race conditions which are
not reproducible when the debugger's
overhead is added to the system. Try
first adding a static pause to make
sure this is the situation and then
moving on to the waitFor kind of
commands.