WebDriver issue - sendKeys() losing focus / posting in wrong order - selenium

I am in the process of moving my home server to a Linode box. After the transition, my WebDriver script has begun acting a little weird.
Both servers are running Ubuntu 16.04 with identical versions of selenium.
However I am running chrome 65 on the new box and 58 on the old.
The issue...
When entering text from MySQL into the description field on the site, if there are no html tags being inserted, everything seems to work as intended. However, if html tags are included, the description field is in the incorrect order.
From watching it run, it looks like the text is being “typed in the correct order, but the cursor will randomly just to the beginning/middle/end of the text field, causing the final field to be in a strange order.
** each iteration of the code produces the text in the same (incorrect) order
** the same results occur whether I am currently Interacting with the machine or not

Related

Selenium writing on two different text boxes for the same sendKeys()

I have an issue where selenium sendKeys(String) method, writes half the string on a text box, then complete the rest of the string in a different text box.
I don't know how is this possible, I think it might be an issue with the selenium driver itself (am using chrome driver 2.13). Any idea about a root cause for this.Note that the code worked fine for a long time.
regards

Selenium IDE skips certain fields

I'm using Selenium IDE to test our website/application. I have noticed that there are specific fields on which Selenium gets stuck. At any test speed, when Selenium gets to that field in the testing it gives out the error that it cannot find the ID. But then I double click on the test line it then goes through. In other words, Selenium IDE can find the ID when I double click on the test line, but not when it is automatic.
Moreover, it is always with the same specific fields. 95% it finds, but a few it gets stuck on in automatic mode.
Also, something similar. I have a specific page where you type data into a series of textboxes. For those specific textboxes it always skips a few of them when in automatic mode. No problem when I double click it. Only when automatic. But all other textboses are fine.
And this occurs even at the slowest speed.
Thank you.

verifytext in Selenium IDE script failing in IE even when it should be passing

Got a Selenium IDE script recorded and being played back using Selenium Server in -htmlSuite mode.It is supposed to put the type the User Name, Password and Domain then click Login. After logging in, at one corner, it should show UserName # Domain. I have a verifyText for this. When I ran the script in Firefox, it is working correctly, but in IE, it keeps failing - giving me an error message Actual value 'UserName # Domain' did not match 'UserName # Domain'. I tried also assert and same thing. Is this a bug in Selenium or something?
You should try using waitForText, waitForElementPresent or waitForTextPresent commands, depending on your specific need.
The reason being that usually, when any text is created by a script on/after the page load, Selenium doesn't know about it - it can't possibly wait for every script to finish, because there's a lot of scripts that never finish and run forever. Therefore, you need to wait for your specific elements to appear before you can assert them.

Selenium clicks on a wrong link (or does not click on a link at all) on certain machines

I am using Selenium WebDriver 2.5.0 (tried 2.13.0, it did not help).
I am trying to click on a link like this:
driver.FindElement(By.PartialLinkText("Customer - Creation").Click();
Before it worked, but I have tried to run the scripts after 3 weeks and
I observe 3 different behaviors on 3 machines:
Machine A: There is no click on the link at all, also there is no error.
Machine B: It clicks a different link! Sometimes one above, sometimes one below.
Machine C (Virtual): It works.
I have not fully tested this (spent half a day today), but did anyone stumble upon such a behaviour?
I have restarted my PC, re-added the Selenium libraries.
"SendKeys(Enter)" helps, but this issue happened not only to links, but to at least radio boxes as well, where "SendKeys(Enter)" does not work.
Please share your thoughts.
Update: Browsers are the same on at least 2 machines, Internet Explorer 8.0
Answered by nebehr.g...#gmail.com at Selenium Issues:
This issue keeps popping up from time to time and is usually returned with request for clarifications. The bottom line is, InternetExplorerDriver calculates coordinates of some objects incorrectly and clicks in the wrong place. One reason for this is zoom value other than 100%; however it is reproducible for some controls for 100% zoom as well.
I suppose it would be helpful if you could create a sample page to demonstrate this issue. In the meantime why don't you use Javascript click() method for offending controls?
http://code.google.com/p/selenium/issues/detail?id=3052
One other thing to check for is the screen resolution (not the desktop resolution but the system level size of text and icons). I have two laptops in my office that are you used for testing, one running Windows 7 and the other running Windows 10. On both, the screen resolution was greater than 100% and Selenium was having problems moving the mouse to the correct location for mouse events like click and hover. As soon as the screen resolution was set to 100%, all mouse actions worked correctly.
Windows 7: http://windows.microsoft.com/en-us/windows7/make-the-text-on-your-screen-larger-or-smaller?v=t
Windows 10: https://superuser.com/questions/951199/windows-10-system-font-size-change
There is a lot of useful info in Andrey's answer and in the Selenium issue he mentions at https://code.google.com/p/selenium/issues/detail?id=3052. Just to tie all those pieces of info together and offer a successful workaround...
I too am experiencing the issue of clicks occurring at the wrong screen coordinates -- four years after the OP first mentioned it! As others have said:
The issue is related to InternetExplorerDriver. I have the problem
when testing IE 9, but not Chrome, Firefox or even IE 8.
As mentioned in the Selenium issue, the website I'm testing uses frames.
I tried several workarounds suggested in this post and elsewhere. All of the following did NOT help:
Updating to the latest InternetExplorerDriver (version 2.47.0)
Maximizing the browser window.
Setting browser zoom to 100%.
Using an action chain, with or without move_by_offset, instead of WebDriver's click() method.
As suggested by Andrey, what DID help is using JavaScript instead of WebDriver's click() method. Here's a line of Python code that does the trick:
driver.execute_script("jQuery('{}').click();".format(css_selector))
This assumes that "driver" is an instance of Selenium WebDriver, and "css_selector" is a string identifying the element you want to click, and that jQuery is loaded.
Sounds like the element isn't present in the page's HTML, but is instead added dynamically once the page is loaded. What happens depends on how fast the machine is and how unique the text is. I'll bet that if you added a long sleep (e.g., a minute) you'd get the same result on all 3 machines. If so, that indicates the single most classic Selenium testing problem - trying to act on pages that aren't complete. You need to find an element to wait on that will guarantee the presence of the link you'd like to click on.
I just had the same issue in FireFox. The zoom was at 100% and the selection was by xpath an certainly correct. Turned out the problem disappeared when I maximized the browerwindow!
code :(python api)
self.driver.maximize_window()

Why are Selenium IDE playback controls inactive? (How can I run recorded tests?)

I started learning how to use Selenium today. I have never used it before. I downloaded the Selenium IDE (1.0.10) plugin for FireFox (3.5.16). The way it's behaving is not matching up to the docs.
When I click the record button and perform actions in my browser, nothing happens in the IDE (nothing is recorded). (Actually, initially it did record, but now it doesn't) I tried restarting FireFox and that had no effect.
Also, the main controls are now inactive. I've included a screen shot to show what I mean by that. The controls remain inactive even it I click or double click on the name of a test case in the panel on the left.
And one final question -- it appears that a Selenium test case mentions Chrome in its default configuration even though the docs say you can only record tests using FireFox. Should I do anything about that?
If anyone can shed light on any of the above mysteries I would appreciate it. Thanks!
UPDATE
I restarted FireFox again and now it's recording actions, but the controls are still greyed-out as in the screenshot, so I can't play back the test.
The issue is that you are not in the HTML runner mode. The IDE has no concept of ruby or python or c# or Java. That is up to plugins which just essentially do a find an replace.
*chrome means Firefox Chrome. Something that has been around for a lot longer than Google Chrome the browser. It means use the browser chrome which removes a couple sandboxing issues.
If you want to play back the tests you can't go out of the table mode otherwise the IDE won't understand what to do. The code in the screenshot should be stored in a .rb file and that should be executed.
Let me try to unravel mysteries -
As soon as you launch the IDE it would be in recording mode. Do you see last Red button which is enabled.
IDE Tests can be executed only when in the selenese/html format (aka table format). I guess you have changed the format to ruby (I guess so), from Option > Format.
To be able to execute tests change it back to html from option > Format > HTML
Take my words, IDE is only and only for firefox