What is the equivalent of Press keys in Selenium2library

Hello everyone, I am trying to run my scripts on saucelabs and because the whole page is not visible I use Press keys Down to scroll the page down to click. On my local there are no issues with press keys but when I run it on saucelabs I get the error “No keyword with name ‘Press Keys’ found. Did you mean:
SeleniumLibrary.Press Key”. Could anyone help please.

Hello Nathan,

Could it be a library version issue?
As stated in Seleniumlibrary, Press Key (singular name) has been deprecated in v4.0.
Press Keys (plural name) has to be use since.

For Selenium2library, it seems the Press Key is still available, but from the error you mentioned it seems you use th first one.

Regards.

2 Likes

Selenium2Library is essentially just an alias to actual to SeleniumLibrary after Selenium2Library version 1.8.0. It has 0 functionality besides providing backwards compatibility where library is imported as “Selenium2Library”.

With the given information, its hard to say anything. It almost feels like 1.8.0 is still being used “in the saucelabs” but afaik, saucelabs just provides remote browser, not execution platform ?

I’d start by seeing what is actually installed in the environment that runs robot itself because, Selenium2Library (1.8.0) does indeed only have Press Key and no Press Keys keyword.

1 Like

Thank you for your inputs people. I am using SeleniumLibrary and the command is “press keys None PAGE_DOWN”. when I run it on my local I can see the page scroll down at this command but on saucelabs it does not. Is there an equivalent command to scroll the page down so I can view all the elements at the bottom of the page.

Hi,

The scroll to top or bottom is sometimes not so easy to achieve.
You may use the “Scroll Element Into View” if you have element locator to refer at the bottom, but the problem is often it stops as soon as the element is visible, so it’s not fully visible.

In case of tables, I usually use homemade keyword to scrool, up, down, middle or % depending of the size, //tr elements.

Then I think some JavaScript commands may do the job (possibility to scroll to a position).

Regards

Actually the Page down did not work properly because it was scrolling the main page and I wanted the left navigation pane to scroll down. Finally I tried Press keys NONE TAB and went to my element which worked!! Thank you all for the quick responses!!