Using Selenium IDE to perform comprehensive tests on all website links

Currently, I am in the process of utilizing Selenium IDE for testing a web application. The page in question contains multiple links that trigger modal windows. My goal is to test every single link on the page in order to confirm that they all result in modals popping up.

Each link is assigned the class "modal", which led me to attempt changing the target value in IDE to css=a.modal. Unfortunately, this method only identifies the first link.

Although I have come across a few solutions involving Selenium RC with Java/Python, these cannot be directly applied to the IDE environment.

While I acknowledge that the IDE may not offer as many features as other tools, my aim is to simplify the process for a non-programmer who will be using it. Thus far, the IDE has proven to be user-friendly for them.

Answer №1

After extensive research, I am grateful to @ohaal and @aleh for their valuable inputs. Their suggested links, combined with additional external reading, led me to the solution below:

<tr>
<td>open</td>
<td>/logout</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>link=Forum</td>
<td></td>
</tr>
<td>storeXpathCount</td>
<td>//p[3]/span/a[contains(@class, 'modal')]</td>
<td>users</td>
</tr>
<tr>
<td>store</td>
<td>1</td>
<td>i</td>
</tr>
<tr>
<td>while</td>
<td>storedVars.i&lt;=storedVars.users</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//descendant::a[contains(@class, 'modal')][${i}]</td>
<td></td>
</tr>
<tr>
<td>waitForText</td>
<td>css=h2</td>
<td>You are not logged in</td>
</tr>
<tr>
<td>click</td>
<td>css=#cross_button &gt; a &gt; img</td>
<td></td>
</tr>
<tr>
<td>store</td>
<td>javascript{storedVars.i++}</td>
<td></td>
</tr>
<tr>
<td>endWhile</td>
<td></td>
<td></td>
</tr>

I would like to acknowledge all contributors for their assistance in arriving at the final solution.

Answer №2

To locate the desired links, utilize a while loop along with this XPath expression: //a[contains(@class, 'modal')]

The links you seek can be found using

//a[contains(@class, 'modal')][1]
,
//a[contains(@class, 'modal')][2]
and so forth.

If you need guidance on implementing while loops in Selenium IDE, refer to this resource for detailed instructions.

Answer №3

Give this a try (make sure to get the extension):

<tr>
    <td>setCssNumber</td>
    <td>css=b.modal</td>
    <td>countedLinks</td>
</tr>
<tr>
    <td>storeValue</td>
    <td>0</td>
    <td>x</td>
</tr>
<tr>
    <td>label</td>
    <td>l2</td>
    <td></td>
</tr>
<tr>
    <td>executeScript</td>
    <td>storedVars.x++</td>
    <td></td>
</tr>
<tr>
    <td>clickAndWait</td>
    <td>//descendant::a[contains(@class, 'modal')][${x}]</td>
    <td></td>
</tr>
<tr>
    <td>ifCondition</td>
    <td>-storedVars.countedLinks</td>
    <td>l2</td>
</tr>

Make sure to add your verifications and close any pop-ups before reaching the last command (ifCondition).

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

The execution of the Selenium script is failing

ChromeDriver version 77.0.3865.40 is now running on port 14991, only accepting local connections. It is crucial to secure the ports used by ChromeDriver and testing frameworks to prevent them from being accessed by malicious entities ...

Unable to perform automated testing on Internet Explorer 11 on Windows Server 2016 with Selenium and IEWebDriverServer version 3.4.0

Operating System: Windows Server 2016 Datacenter (64 bit) Browser: Internet Explorer 11.0.14393.0 Protractor Version: 5.1.2 Selenium Standalone Server Version: 3.4.0 IEWebDriverServer.exe Version: 3.4.0 Java Version: 1.8.0_131 We are currently facing chal ...

The compatibility between Selenium Chromedriver and PHP Python is not functioning properly

I've been working on a Python code to take screenshots of websites. import time from PIL import Image from selenium import webdriver options = webdriver.ChromeOptions() options.add_argument("--no-sandbox") options.headless = True driver = webdriver. ...

Tips for waiting for a button to be clicked by the user in Selenium web-driver with Python?

I have a Login form with a username, password, captcha text field, and SIGN-IN button. The elements are clickable and visible from the beginning. https://i.stack.imgur.com/rHbms.png With Selenium, I am able to provide input for the username and password ...

Using Python and Selenium to automate web browsing, you can open multiple tabs in

I am experimenting with a Python script using Selenium to open multiple chrome tabs. I have created a loop as shown below, but it seems to stop at 9 windows when I substitute ""url"" with the actual URL pointing to a video. Could there be an is ...

How can we implement a functionality to close the fullscreen dialog from an external source, ensuring seamless user experience?

I passed a state as a prop from a functional component to a fullscreen dialog. How can I close the dialog after it is displayed by triggering onClose or onClick? const [openDialog, setOpenDialog] = React.useState(false); <MyDialog open={openDialog}/ ...

Generate an asynchronous boolean promise when calling the isPresent function in Protractor

I'm currently working on a function that checks the presence of an element and returns a boolean value accordingly. However, I am facing an issue where the response includes unnecessary information. the output displays: false How can I adjust my cod ...

Tips on resolving the issue of an element being unclickable at a particular point in Selenium when using

I'm currently testing a script that involves navigating through approximately 200 pages. Each page features an edit button that needs to be clicked on. While I successfully click the button on about half of the pages, the other half presents an error ...

Unable to locate the root element for mounting the component in Cypress with React

I am currently testing my react app, which was created using create-react-app, with the help of cypress. Unfortunately, I encountered an error that looks like this: https://i.stack.imgur.com/xlwbo.png The error seems to be related to trying to fetch an ...

When an element is not found, selenium often encounters issues with getting stuck

Struggling to gather data from the IMDB website and save it to a CSV file using my code. Whenever I encounter an element that is missing, the process gets stuck. Check out my script below: from selenium import webdriver from selenium.common.exceptions im ...

Is there a way to extract the text that is displayed when I hover over a specific element?

When I hover over a product on the e-commerce webpage (), the color name is displayed. I was able to determine the new line in the HTML code that appears when hovering, but I'm unsure how to extract the text ('NAVY'). <div class="ui ...

Evaluating the performance of a Heroku free server under stress conditions

I'm currently working on an Android app that has a backend hosted on a Heroku free server. The current response time for serving requests is 2 seconds. I'm curious to know how many users it can handle simultaneously. I've searched through v ...

I'm encountering a Python Selenium error related to the timing of webpage loading

# Specifying the path to the chromedriver program service = Service('C:\Program Files (x86)\Google\chromedriver.exe') service.start() # Opening a remote connection with robinhood website using the driver driver = webdriver.Remote( ...

Tips for always focusing on a textarea within an Angular UI modal when opening the modal

I am facing an issue with setting focus to a textarea within an angular ui modal. I need the focus to be set when the modal is made visible, but it cannot happen during document load as it only works the first time the modal opens. Furthermore, the modal ...

Downloading a file utilizing Selenium through the window.open method

I am having trouble extracting data from a webpage that triggers a new window to open when a link is clicked, resulting in an immediate download of a csv file. The URL format is a challenge as it involves complex javascript functions called via the onClick ...

Breaking down objects and actions within the page object model with Selenium

Currently, I am involved in creating a selenium-based automation framework. As part of this project, I have developed a Dashboard page that consists of over 100 different web elements, each requiring specific actions to be performed on them. My question ...

Attempting to select an input field

I'm having trouble clicking on the Select Files button that is nested within a SPAN and Input Tag. Despite using Xpath, Id, and Name, I am unable to successfully click on the button. <span> Select <u>a</u> Files... </span> & ...

Why bother writing tests using keywords and the robot-framework syntax in RobotFramework?

I'm pondering the benefits of utilizing RobotFramework for writing tests in its syntax compared to creating custom libraries. For instance, imagine we need to create a test that scans a directory and confirms no files have been altered. This could be ...

Utilize C# Console and Selenium to Extract Information from Text File

Recently, I developed a C# console application using Selenium with Chrome Drivers. I'm currently facing an interesting challenge that I could use some help with. The idea is to have a file named emails.txt where users can input email addresses such as ...

Is there a way to extract the complete table from a website and import it into an excel spreadsheet?

I am attempting to extract the complete table data from the following website: Note that upon clicking the link, a public login button will need to be clicked first. I have already set up a bot to handle the login process and navigate through the site, so ...