BrowserStack - Incorrect SendKeys on IE11 - selenium

I am running a Selenium test on BrowserStack and sendkeys command is not sending the specified text to the input field. I noticed that this issue usually occurs with special characters like #, #, etc.
How do I fix it?

It is a known bug with IEDriver. SendKeys command doesn't work well with special characters and drops some letters from the input string.
You can refer the GitHub Issue - https://github.com/seleniumhq/selenium/issues/805#issuecomment-396581314
I recently found that BrowserStack has "browserstack.sendKeys" capability to overcome this.
Refer this SendKeys on IE11 article on BrowserStack

Found related issues you may check -
How to fix the slow sendkeys on IE 11 with Selenium Webdriver 3.0.0?
https://github.com/seleniumhq/selenium/issues/805
https://github.com/SeleniumHQ/selenium/issues/5103

Related

Selenium IDE sendkeys() without target

i'm using selenium IDE for automation testing, i tried to use keypress on selenium, but because my site blocking any click and can only use keyboard for operating, i cant use sendkeys() to run it with selenium IDE because the empty target, is that possible to use sendkey without target? or is that another way to press key without target?
thanks for helping.
In regular Selenium you can sendKeys without a target web element with Actions.
As I see here this can also be done with Selenium IDE.
There are more additional documentations and tutorials about this.
Yes you could use ActionChains in regular Selenium, as mentioned in the previous answer. This definitely will work. But I am needed to use Selenium IDE.
A work around might be executing some JavaScript with the execute script command in Selenium IDE to trigger the key press that you need. That might work. I have found some code snippets online for that, but haven't yet worked it out. Actually I'm surprised that there's not a simpler solution.

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

Selenium IDE down arrow key

I'm stuck trying to get my selenium testing to simulate a down arrow key press.
Im just using the html format for my tests and am using typeKeys as the command, the target is correctly found, and for the value I am putting in \40 which seems to be converted into \\40 in the UI. When I run the command it ends up appending \40 to the current value of the input.
I'm using the latest version of the selenium ide from the site.
Any pointers?
Cheers
Selenium provides its own methods for this task.
Try using keyDown() instead of typeKeys()