Trouble with if/else for clicking links with Selenium IDE - selenium

I am trying to load a page and click either the first link with text "Buy It Now" or (if Buy It Now is unavailable) the first "Quick Bid" link.
I am using the Selenium IDE extension for Chrome (https://www.selenium.dev/selenium-ide/) and am having trouble with the if / else statement. In Chrome, when I get to the page where "Buy It Now" or "Quick Bid" are found, I try manually inserting the if statement with the target
linkText=Buy It Now
On playback, when I get to this line, I get:
Failed: Unexpected identifier
I also tried the if-target:
linkText=Buy It Now == true
But I get the same error.
In case it was the IDE, I also tried the same macro, but with Katalon Recorder. It gives a similar error:
[error] SyntaxError: unexpected token: identifier
What am I doing wrong here?

Related

Selenium IDE "Tab not found' although it is open

I'm using Selenium IDE to automate some browser processes, I need to do a test from which I open the source code of a page (view-source:https://www.youtube.com/watch?v=JeQuelXsUYA) and trying to find a certain word, I am using youtube as an example, however when clicking on "Select target in page" the following error appears "Tab not found / No guide is available for this test case, please keep recording or play. " I've tested it with several pages, and command recording works fine, but every time I open the page's source code, the selenium IDE doesn't record the commands.
Thanks in advance.
[![This is the image of the error, the first script I ask to open the page's source code works, however when I try to select target in page, the error appears, as if the page were not open.1

Timeout after 30000ms in Selenium IDE

I'm trying to open a page (target: /selenium#/login), but I keep getting a timeout error. The page seems to be done loading so I don't get why I keep getting the error. Also, the error only occurs when I'm playing the entire test suite. When I try to run each test case individually, the error doesn't appear.
EDIT: Forgot to mention, the error doesn't occur when I open a new tab right before the next test case starts (before the open command is read), so each test case has to be on an entirely new tab/window. Here's a screenshot: http://i.imgur.com/pF2e6iU.png

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

Extjs SyntaxError: invalid property id

I have an Edit button, but when I click on it, instead of the Edit User popup window appearing, I get a JavaScript Error, namely 'SyntaxError: invalid property id'. This is what I get when I run in Firefox.
However, when using Internet Explorer, clicking on Edit button generates the following error: 'Microsoft JScript Compilation error: Expected identifier, string or number.' Again, no Edit User popup window appears.
It seems that something is wrong in the way the Edit User popup window is sent back. Tthe code executes and shows the loadMask msg 'Please wait...', but the Edit User popup window is not displayed. Any tips on how to discover/fix the error would be appreciated.
Solved it! The response.responseText returned the Edit User pop up (i.e. the edit.vm file). There was a random % sign in the edit.vm file which was causing the problem.

Selenium RC - selenium-browserbot.js error

I'm writing some automated tests in C# and a JavaScript error is thrown when I try to click on a button that will submit changes made to a web form. The error I am recieving is:
An error has occured in the script on this page
Line: 2004
Char: 9
Error: Permission denied
Code: 0
URL: file:///C:/DOCUME~1/nkinney/LOCALS~1/Temp/customProfileDir6c0c7d7226cc463fb­b1a7f6253c4df62/core/scripts/selenium-browserbot.js
Once the test is finished, the error will still be displayed if I manually click on the button while selenium is running.
The line in selenium to select this button is:
selenium.Click("//input[contains(#id, 'SubmitBtn')]");
I've also tried submit.
A pop-up should be displayed asking the user to confirm they want to make the changes. This error is thrown before the pop-up is displayed and after Selenium 'clicks' on the button.
Any advise would be greatly appreciated.
After further investigation, I found that Selenium is unable to work with custom modal dialog boxes. That said, I don't think I will be able to use Selenium to automate UI testing in our current release. Thanks to anyone who looked at this post.
From the Selenium FAQ
I can't interact with a popup dialog. My test stops in its tracks!
You can, but only if the dialog is an alert or confirmation dialog.
Other special dialogs can't be dismissed by javascript, and thus
currently cannot be interacted with. These include the "Save File",
"Remember this Password" (Firefox), and modal (IE) dialogs. When they
appear, Selenium can only wring its hands in despair.
To solve this issue, you may use a workaround (if one exists);
otherwise you may have to exclude the test from your automated corpus.
For the "Save File" dialog in Firefox, a custom template may be
specified when running via the RC that will always cause the file to
be downloaded to a specified location, without querying the user (see
http://forums.openqa.org/thread.jspa?messageID=31350). The "Remember
this Password" dialog should not appear again after you've chosen to
remember it. Currently there is not much that can be done about IE
modal dialogs.
Do you have the option of seeing if the test runs in another browser (Firefox, Chrome)?
A very similar answer is also here: How do I test modal dialogs with Selenium?