verifytext in Selenium IDE script failing in IE even when it should be passing - selenium

Got a Selenium IDE script recorded and being played back using Selenium Server in -htmlSuite mode.It is supposed to put the type the User Name, Password and Domain then click Login. After logging in, at one corner, it should show UserName # Domain. I have a verifyText for this. When I ran the script in Firefox, it is working correctly, but in IE, it keeps failing - giving me an error message Actual value 'UserName # Domain' did not match 'UserName # Domain'. I tried also assert and same thing. Is this a bug in Selenium or something?

You should try using waitForText, waitForElementPresent or waitForTextPresent commands, depending on your specific need.
The reason being that usually, when any text is created by a script on/after the page load, Selenium doesn't know about it - it can't possibly wait for every script to finish, because there's a lot of scripts that never finish and run forever. Therefore, you need to wait for your specific elements to appear before you can assert them.

Related

Selenium IDE Test Runs in GUI - But Fails when run in CL (linkText not Visible)

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.

Selenium IDE Custom error messages

I have read this (How to customize Selenium test error/fail message) question and it gave me some hope but can this be done with selenium IDE also? My boss wants to automate all tests but wants to keep it simple for non programmers to use so I cannot use WebDriver or jUnit.
I had a similar issue and came out with a surprisingly amusing answer. Selenium will write a failure only upon stepping on an error. In the current case I wanted Selenium to warn me if the 'Log In' button was absent on my page but a gotoIf wasn't going to do the job alone. Therefore I forced Selenium into an error by writing a click command that didn't exist 'TestLoginB2B failed because the login button was' and using it as my custom error line as Selenium will mention the name of a failed click command and always write them in red therefore allowing my file logging addon to spot them.
Custom error message

Error in Selenium testcases while running

Using Selenium IDE, I recorded one testcase that contained a click url, then give the username and password and clicked the button to navigate to next page.
In the render page, if I click any link the error is shown as Element link=linkname not found.
Why does this error occur?
Page is fully loaded when that command is executing?
If not just put waitForPageToLoad or pause command.
waitForPageToLoad | timeout
Or
pause | 5000
Also you can use command clickAndWait for button after entering username and password
There are different ways via which you can handle such issues. The issues can be of rendering as username and password click is fine as you will rest on same page when you enter values in these test boxes.
But as soon as you click on submit button then application has to load a new page with the credentials you have just added.
So this requires some time in terms selenium. What you can do is you can put some waits just after this action. So far selenium provides two types of waits Explicit and Implicit waits.
And you can try thread.sleep() , its a java type of method which is also a kind of wait. But implicit and explicit waits are highly recommended in Selenium coding.
You can refer to this blog for more knowledge on waits (http://khyatisehgal.wordpress.com/2013/05/09/how-to-handle-timeouts-implicit-and-explicit-waits-in-selenium/)
Khyati Sehgal

Automation of DOH Robot tests interrumped by Pop-up message

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.

Selenium: How to stop RemoteRunner.html from getting invoked

I am using selenium for one for my Java applications on linux. The application invokes a mozilla browser, fills login details (username and password), and then submits the form. I am able to achieve this using selenium, but every time a url is selected 2 instances of mozilla is getting invoked. One instance is that of the url selected and the other instance is a RemoteRunner.html which has selenium command history and other details.
I don't want this page to be invoked. Is there a way to stop this page from getting invoked?
Thanks and Regards,
Sunil.
The RemoteRunner window is required as it is controlling the application under test within the other window. You can run Selenium in a single window using the command line option multiWindow=false however this uses frames, which can sometimes cause issues with the application under test.