The issue I'm having is with the command Go Back from the selenium library within RIDE.
I have tried to input the Go Back command into a test script im running. The website should then simulate a click on the back button within the browser (chrome). It however does not seem to work while it does tick off the step as done and passed. I googled some stuff and found out sometimes the browser isnt ready loading when trying to perform the next command and thus it could create an issue. Because of this i tried to implement the Set Selenium Implicit Wait 10 seconds command
In the img link below (can't post the img because im not 10 reputation) you can see that I have the command Go Back and Set Selenium Implicit Wait 10 seconds. Neither however seem to work (notice that while the timer is suppose to wiat 10 seconds. it is marked as completed in 00:00:00.003
https://gyazo.com/fa18566997436989ab5a6503b9064965
I noticed that both come from the seleniumlibrary and while installed and imported (or Close Browser would not work) neither works. I'm not sure what im doing wrong here. In the picture below is how i wrote it down in the testcase.
https://gyazo.com/7d914c7c74999177ae2dca4a02d4a4bb
Any help would be much appreciated into making the bowser use the back button and/or explaining why certain aspects of the seleniumlibrary don't seem to work.
See the implicit wait section. It can be read like "the maximum time when waiting to find the element". When you use the Go Back keyword, there is no element to wait for, so it is immediate.
See here a complete example (that would work as long this question is on the first results page):
*** Settings ***
Library SeleniumLibrary
*** Test Cases ***
Move Back On Browser
Open Browser https://stackoverflow.com/questions/tagged/robotframework%2bselenium?tab=Active Chrome
Scroll Element Into View xpath=//a[.='Seleniumlibrary command not working with Ride?']/../..//div[contains(#class, 'excerpt')] # Scroll to excerpt, because Cookie Policy ovelay is over URL element
Capture Page Screenshot active_questions.png
Click Link xpath=//a[.='Seleniumlibrary command not working with Ride?']
Capture Page Screenshot target_question.png
Set Selenium Implicit Wait 10 seconds
Go Back
Capture Page Screenshot after_go_back.png
[Teardown] Close Browser
Related
When my saved project and test runs in the Selenium IDE GUI it's fine, but when I perform the same test called via the command line side runner it fails. The issue appears to be the linkText not being visible, but I don't understand why it would fail when it runs fine form the GUI.
You can see the last step (8) as passed, with reference to the linkText
I then save the project in my local folder
And run it again using the side runner command
ElementClickInterceptedError: element click intercepted: Element Corporate Project/Program/Event (CORP) is not clickable at point (798, 199). Other element would receive the click: ...
It appears that the linkText maybe covered? The weird thing it's visible to me when the selenium test is running, just before it hangs. I did try to add some wait commands, i.e. "wait for element visible". But didn't seem to help.
Maybe I didn't insert the command properly?
I feel like I must be missing something obvious. Any suggestions?
I've found similar threads on GitHub that indicate differences in the way the IDE core and web driver work. One user indicates it actually IDE that's clicking through an overlay. I've managed to overcome my issues using simple pause commands, unsure why the wait commands didn't work for me.
I want to take screenshot of the entire web page. I have tried using
capture page screenshot
But the problem is that it takes the screenshot only of the visible part of the webpage. I want the screenshot for the whole page.
You have to tinker something for yourself. For example you can setup a loop where you are sending PAGE DOWN keys to the browser to scroll down and take a screenshot after each iterations.
E.g.:
*** Settings ***
Library SeleniumLibrary
*** Test Cases ***
Take Screenshot
Open Browser https://stackoverflow.com Chrome
FOR ${i} IN RANGE 4
Capture Page Screenshot
Press Keys None PAGE_DOWN
END
[Teardown] Close All Browsers
You have to decide based on your application how many scrolls you need.
I'm exploring Robot Framework for some smoke testing of a site, and at a point have to sign in, which opens a new window. Moving to the new window with Select Window works for me, but I'm bridging this change by identifying the title of Sign In, and the new window does not immediately adopt that title as it loads your login form - sometimes this takes half a second, sometimes more than 5.
I'm working around this right now by having the test sleep for the obnoxiously long period of 10s, but surely there are more reliable ways of ensuring that I can change my target window to the new one, and not have my test fail and exit while the page is loading. I took a shot at using the redirect url as the identifier, but sometimes it redirects very quickly and fails, or if not, then it gets hung up on the next check for the login field that isn't loaded. I've seen commands like Wait Until Element Is Visible, but unfortunately that doesn't help when I can't target the window where things are loading...
For the sake of it:
*** Test Cases ***
Basic Workflow
Open Browser To Homepage
Go To Sign In
*** Keywords ***
Open Browser To Homepage
Open Browser ${HOMEPAGE} ${BROWSER}
Maximize Browser Window
Set Selenium Speed ${DELAY}
Go To Sign In
Click Button Sign In
Sleep 10s
Select Window Sign In
Title Should Be Sign In
Using Selenium2Library currently.
lauda had it right in writing out a Keyword for managing the Select Window. I found Wait Until Keyword Succeeds and made a keyword for it to wait on.
Go To Sign In
Click Button Sign In
Wait Until Keyword Succeeds 20s 3s Switch To Sign In Page
Title Should Be Sign In
Switch to Sign In Page
Select Window Sign In
Thank you, both!
I can see the enabled button while running. I can select that button using Selenium IDE and the xpath. But when it comes to running using WebDriver it is not able to find the element.
Are you using the localhost? because sometimes if it takes some extra seconds for the Web Browser to load (for example Firefox), then when Selenium tries to do the action it doesn't find the elements obviously resulting your error.
Use the pause command, for example 5 seconds, so that the Selenium waits 5 seconds before the action is executed, giving time for the website to load.
Try the coding somewhere on this level
driver.manage().timeOuts().implicitlyWait(5,TimeUnit.SECONDS);
In order to automate DOH tests during our build process, I use Selenium RC to launch different browsers (IE and Firefox) on a server placed on a different domain than the build machine. Each browser is directed to our runTests.html in order to start DOH.
Sometimes, when a test that uses doh.robot starts, the following message is shown:
"DOH has detected that the current web page is attempting to access DOH, but belongs to a different domain than the one you agreed to let DOH automate. If you did not intend to start a new DOH test by visiting this Web page, press Cancel now and leave the Web page"
but since these tests are unattended it just sits there waiting for someone to click OK, and Selenium times out (in IE 8 it seems like the pop-up disappears automatically but the robot does nothing afterward).
As I said, it doesn't always happen. After you click OK on the Pop-up, the message will stop showing, and the message can go away for several sessions, but then it will show again in which seems to be an arbitrary way.
Does anyone knows a way to prevent this pop-up from showing?
This is probably not the correct way to do it, but in util/doh/robot/DOHRobot.java, you may be able to modify the code to not check that or always simulate pressing "OK". I haven't tried it myself, but I may also need to do that for some of our automated testing.
When the DOH robot is initialized, it first tries to click in the upper left corner of the page you are trying to test. If you obscure this div (you can see it with firebug), then the message will pop up. I think the problem is that your page isn't always loading up quick enough.
It is somewhat of a challenge to fix this. I haven't used DOH in awhile, but I don't think there is any way you can use a setTimeout to fix this. (You can try using setTimeout on the doh.run command, but it might be the case that the DOH robot clicks that div before parsing any doh commands.)
Another thing you might be able to do is add a sort of "wait" command to Selenium, or whatever shell command you are using to fire up the system.