Hello,
I’m a beginner in robot framework.
I had developed these few lines in a python script using selenium to cause the display of a window by Ctrl+R
*# Create an action chain object*
actions = ActionChains(drv)*
actions.key_down(Keys.CONTROL)*
actions.pause(5)*
actions.send_keys(‘r’)*
actions.pause(5)*
actions.key_up(Keys.CONTROL)*
actions.pause(5)*
actions.perform()*
I’d already had to do some research to find the right combination to use in my context. But it works well in my context.
But now I want to reproduce the same function in the robot framework and I’ve tried a lot of different methods.
Syntactically, I don’t have any errors, but in all my attempts, I’m never able to get my dialog box to appear after executing the CTRL+R key combination.
I’m starting to run out of inspiration.
I don’t understand what you want to do, but in Chrome and Firefox, Ctrl-R is to reload the page, not to open a new page. For this it would be Ctrl-N for a window, and Ctrl-T for a tabbed window.
Just a hint, but your selenium example uses a xpath with iframe.
Usually to interact with it you need to Select Frame first, so maybe the CONTROL+R is send, but not on the element you expect.
Also you have Set Focus To Element maybe.
To give you a bit more context, I need to develop automated tests for an application.
In the sequence of steps, once I’ve opened a page to authenticate myself and then opened one of the applications on this portal, I need to press CTRL+R inside this application to trigger the appearance of a window that will allow me to enter a program name.
Thanks Charlie
In my context, in the DOM, the window that will appear following the control+R will then be included in an iframe that I will have to select afterwards to enter the name of the program to be launched.
What I’ve given as an example in my post doesn’t include all the examples I did before writing this post.
Among these, I did indeed try to select only the body, for example.
But all my attempts failed in the sense that I can see that the CONTROL+ was interpreted correctly, but it didn’t trigger the opening of my window.
So, of course, the rest of my sequence doesn’t work.
But I’m going to try again, but I must admit I’m running out of ideas.
Manually the CTRL+R works no problem, but with RF indeed no matter where the focus is set, use of Press Keys, Javascript injecting into the page, I couldn’t get the CTRL+R displaying the iframe.
Finally simply tried to replace in the DOM with ‘j’ instead of ‘r’, and there this works easily
Press Keys //p CONTROL+j
So I assume the Selenium driver and browser doesn’t take in account the keys as they’re reserved for refresh.
Easiest way, I would consider eventually modifying the shortcut if possible with dev team.
Or eventually you could go down the profile use for testing, that would allow maybe to use one where shortcut are redirected/redefined.
Hopefully also somebody has an idea
Thank you for your efforts to help me. I really appreciate it.
Unfortunaly, it’s an application for which I can’t customize the use of the function keys.
So, given the difficulty I’ve already had finding the way to do CTRL+r in Selenium (but confirming that it was possible), I persisted in finding a workaround using the same idea.
In the end, I created a custom library to handle the code below, and it works! You really need to mark pause times otherwise it doesn’t work.