I recorded a test where I had to scroll down to the bottom of the page until a button appears.
It recorded opening browser, loading URL and clicking the button but not the scroll down. The button is not visible until I am able to load additional content (until a maximum of 72 content cards are loaded) … once the number of content cards are loaded then a Show More button is displayed.
Running the recorded script fails since it cannot find the button to click on.
Another way can be
WebUI.sendKeys(findTestObject(null), Keys.chord(Keys.ALT, Keys.DOWN))
This would simulate the scrolling as you are doing through keyboard.
Thanks … I know how to scroll using WebUI keywords BUT I was trying to record a test case and it does not capture the scrolling so that the playback fails since the element I am pressing is not visible until I have scrolled to the bottom… I am looking for the recorder to capture the scrolling and add it to the script.
This is about record not capturing the complete session and not specifically about scrolling.
The recorder wont take scrolling to elements into consideration, because the underlying seleneium methods that are ultimately generated by the recorder will inherently try to scroll to elements anyway before manipulating them. If the recorder did this as well, there would be quite a bit of redundancy.
Generally speaking, recording test cases and expecting them to behave EXACTLY as you did as a manual user is unrealistic. Tweaking your recorded test case is just part of the game. I would take @Russ_Thomas’s suggestion and inject either of those methods into your recorded script in the appropriate places.
I had already written the test case using the WebUI keywords that he mentioned but wanted to see how the recorder might capture the events and found that it didn’t capture all of the key strokes like I believe it should … which is my opinion and I do not believe to be an unrealistic expectation.
You are, of course, entitled to your opinion. I’m just telling you why the recorder is not doing what you’re saying it should be doing (again, because it would cause a lot of redundancy due to how Selenium works). If you want a 1-1 playback of your actions, I’m not sure what to tell you. Use mouse macros?
Thanks … There are other recorders that record all keystrokes … I use the recorder from SmartBear for LoadNinja to do performance testing and it captures everything and it sits on top of and uses Selenium. It does not have duplicate scrolling so it is possible.
Let’s add it as a requested feature: It could be a user option to record everything and then let them edit it out if there is an issue since Selenium does not always scroll and I haven’t found any cases where it does.
Thanks for all of the input.