Newest version of SafariDriver Cant Find Element Locations - selenium

In the newest version of SafariDriver that was shipped with Safari 12 I am seeing an issue where calling element.Location is throwing an error:
'The given key was not present in the dictionary.'
Of course this does not happen on Chrome or Firefox. What is strange is that I am able to execute click(), and SendKeys() without any issues. I would assume that both of those methods would need X and Y coordinates. Has anyone else run into this issue? I have a bug filed with Apple as well to look at the issue.

Related

Wait required before Selenium-ChomeDriver/Chome can click element correctly (ChromeDriver v 77 & 78, Chome v 78)

As mentioned in the title, the following issue occurs since chrome was updated to v78. Before chrome v78 all tests worked just fine.
The behavior is highly nondeterministic, so please bear with me.
Meaning sometimes it just works out of a sudden, without any changes. Most of the clicks in the tests are working. Just some fail repeatedly (most of the time).
We are using selenium with the latest driver for chrome 78. The problem appeared first on driver version 77 with chrome 78 running.
Not the spec-flow tests nor the adapter-code has changed in any way, but after the Chrome update basically all tests failed.
Doing a Thread.Wait(1000) before EVERY CLICK seems to be the most reliable way to avoid the problem, and clicks the element as requested.
When im not waiting, the driver runs through the "Click", including the steps listed below, without actually clicking or throwing any error.
lookup of the element:
new WebDriverWait(this.webDriver, this.WaitTimeout).Until<IWebElement>(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(by))
waiting for the element to be clickable:
wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementToBeClickable(by));
scrolling towards the element:
((IJavaScriptExecutor) this.webDriver).ExecuteScript("window.scrollTo(0, " + (object) (e.Location.Y - 250) + ")");
and performing a click and release action on the element:
action.Click(element).Perform()
i have also tried several other variants of mouse clicks including the one from the comment.
Since the process just works through all this, without actually throwing an error or warning of any kind, i have no way of checking if the click actually happened (other than checking the current URL, which would be a nightmare to maintain in the tests).
So the website is not updating and remains on the source page and the test will fail because the next test doesn't run on the expected page.
now the question:
Is there anything i can query for or wait for to see whether the driver or chrome can actually click that element (really) or to verify that it was actually clicked?
original issue report:
https://github.com/jsakamoto/nupkg-selenium-webdriver-chromedriver/issues/66

Why does Selenium ExecuteScript method doesn't work anymore in Salesforce application but ExecuteAsyncScript works

Hi I've been trying to figure this for the past couple of days. I wrote the code below that use to work but doesn't work any more using the ExecuteScript method. The only thing i have changed was update my chrome driver because it was not launching chrome since the driver wasn't working with the older chrome version I have. So once I updated the chrome driver it began to work until i had to run this piece of code. I modified it below not to what the actual link text is.
IJavaScriptExecutor js = (IJavaScriptExecutor)WebActions.One;
js.ExecuteScript("alert('Welcome to Guru99');"); // This was added for testing purpose
IWebElement somelink = WebActions.One.FindElement(By.XPath("//span[text()='Some Text']"));
js.ExecuteScript("arguments[0].click();", somelink );
When i changed the method to be ExecuteAsyncScript it started working again. Is this something that has changed with the app or is this something i'm doing wrong. I tried reading up on ExecuteAsyncScript vs ExecuteScript to see the difference but all i was able to get was something about the call back telling
when its finished which i'm not experienced in java script.
I would just like to understand more then anything or should i just start using ExecuteAsyncScript method. Thanks
There's a chromedriver ticket about this issue here:
https://bugs.chromium.org/p/chromedriver/issues/detail?id=3103
It states:
The cause of the issue is this website modifies the constructor of the
built-in AsyncFunction object. This causes difficulty when
ChromeDriver tries to create an AsyncFunction to wrap the script being
executed.
chromedriver 78 fixes the issue. For testing with Chrome 77, the ticket recommends switching to executeAsyncScript, or using chromedriver 76 since "ChromeDriver vX will run with Chrome vX+1".

How to fix types.ArgumentError: argument 1: <class 'TypeError'>: expected LP_POINT instance instead of pointer to POINT?

I'm using selenium, pyautogui, pywinauto to automate the desktop app. I'm automating settings app. And based on the user's input value I'm trying to change the value of the current brightness of the computer. but it keeps on showing this error.
The most important part is I wasn't getting the error 3 weeks ago and everything was working fine but yesterday when I run the script it started throwing the error.
The complete error I'm getting is-
ctypes.windll.user32.GetCursorPos(ctypes.byref(cursor))
ctypes.ArgumentError: argument 1: : expected LP_POINT instance instead of pointer to POINT
Some part of the script where the process get stuck and starts throwing the error. the script stop running at the 3rd line...
slider = content_of_page.find_element_by_id("SystemSettings_Display_Brightness_Slider")
slider.click()
pyautogui.dragRel(args.value, 0, duration=1.0, button='left')
pyautogui.click()
I'm using pyautogui=0.9.47
I also had the same issue and reinstall did not help. I found solution in: https://github.com/asweigart/pyautogui/issues/353
After installing pywinauto==0.6.6 all work ok for me.
I had the exact problem just right now.
I fixed it by un- and reinstalling pyautogui and pywinauto.
The problem persisted after reinstalling pyautogui, but was fixed after reinstalling pywinauto. So I am not sure if you need to reinstall both or just pywinauto.
Hope that helps!
Andreas

JavaScript Error: e is null popup during Selenium Test

I have test which is resulting in a Firefox pop-up which looks like this:
The exception is an InvalidOperationException and it goes on to say
JavaScript Error: "e is null" then making reference to a JavaScript file called commandprocessor.js
I am using the 2.44.0 version of WebDriver with Firefox version 33.
Out of completeness, I will also add that this pop-up is not throw on if a user manually follows the steps in that test.
Any ideas what is going on? Previous SO questions with similar error have yielded no answer.
Could be an issue with the driver itself. Have you looked at these issues logged with selenium webdriver?
Issue 7977: Upredictable javascript errors "e is null"
Issue 8095: fxdriver.error.toJSON fails to match qualified method names containing $
Based on the rev logs these fixes seemed to have been added after 2.44.0 release so they may not have made it yet to a release version.
In one of the callbacks, the code included
$('#confirmRegistration').attr('href', 'javascript:location.reload();');
Seems to be forcing a page reload, which the WebDriver did not like.

Frames issue using Watir-Webdriver and phantomjs

I'm writing test using Watir-Webdriver and phantomjs and I've got an issue with iframes.
I'm trying to get an element with the following code:
browser.frame(:index => 0).div(:id, "wrapper").exists?
and when I'm using phantomjs, it raise an error:
NameError: uninitialized constant Watir::FramedDriver::UnknownFrameException
but when I'm using chrome driver, the code above works properly and returns "true" value.
Any ideas how can I fix it? Or maybe there is any other way to get this element using phantomjs?
Any help will be appreciated. Thanks!
My guess is that ghostdriver does not have support for frames. I could not find an open issue related to frames in it's bug tracker: https://github.com/detro/ghostdriver/issues If you think it is a bug in ghostdriver, you should report it there.