Discovering if a div element has children using Selenium IDE

As I begin to automate testing for our website with Selenium IDE, I must admit that I am still learning the ins and outs of it.

We utilize highcharts to exhibit data on our site. The challenge arises from the fact that there are 3 div elements handling the charts, each with a different id. This fluctuation in ids complicates the process of locating specific elements.

To keep things concise, I will focus on the crucial part of this issue: the div objects in the HTML structure showcasing the charts.

Here is a snippet of how these div objects appear in the HTML source:

<div id="numRecs" data-highcharts-chart="3">
   <div class="highcharts-container" id="highcharts-6">
   </div>
</div>

<div id="activeStream" data-highcharts-chart="1">
   <div class="highcharts-container" id="highcharts-2">
   </div>
</div>

<div id="delay" data-highcharts-chart="2">
   <div class="highcharts-container" id="highcharts-4">
   </div>
</div>

The identifier "highcharts-4", which is associated with the (div class=highcharts-container), changes periodically, making it challenging to target the element consistently. Although the (data-highcharts-chart=2) value also varies, its impact on locating the div id=delay is minimal.

Despite attempting to identify the object by right-clicking on it within the browser, I received an error indicating "css=svg > rect". How can I instruct Selenium IDE to verify if the parent div (div id=delay) contains children? My hope is that determining the presence of child elements will offer a solution to this predicament. Thank you for your assistance in advance.

Answer №1

To determine if a specific element is present on the webpage, you can utilize the verifyElementPresent command. For example, to check if a parent div (identified by id='delay') contains child divs, you can target it using //div[@id='delay']/div

For more information on this topic, refer to the Selenium IDE documentation: http://docs.seleniumhq.org/docs/02_selenium_ide.jsp#verifying-page-elements

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

Concealing a child component when hovering over its parent element with styled-components

I have a react component structured like this - const MyComponent = () => ( <ContainerSection> <DeleteButtonContainer> <Button theme="plain" autoWidth onClick={() = ...

Selenium Webdriver | Element with 'href' attribute cannot be found

I have been attempting to find a specific link using Selenium Webdriver with Xpath and CSS. <table width="100%" cellspacing="0" cellpadding="0" border="0"> <tbody> <tr> <tr> <td class="cspbItmA"> <a class="cspbItm" target= ...

Tips for activating scroll feature for certain section of an HTML page

For the styling of my page, I'm utilizing Scss and am facing an issue related to setting up scrolling for specific sections of an HTML page. You can check out the image reference here. During a scroll event, I want to ensure that the Categories (left ...

Stop the stream coming from getUserMedia

After successfully channeling the stream from getUserMedia to a <video> element on the HTML page, I am able to view the video in that element. However, I have encountered an issue where if I pause the video using the controls on the video element a ...

Emphasize the most recent file during the document upload process and ensure the scroll bar moves accordingly to the document

I am currently working on a feature where the scroll bar should move to the newly uploaded document in a list of documents. When I upload a new document, I want the scroll bar to automatically move to that document. Currently, the highlighting changes to t ...

Unable to choose multiple sentences within an HTML Page displayed in a UIWebView

I am dealing with an HTML page structured as follows: <html> <body> <div id='0> <span id='0'>Hi </span> <span id='1'>How </span> <span id='2'>Are </span> <sp ...

Utilizing jQuery taggd to add annotations to images

I am currently utilizing the taggd Plugin to develop an application that creates a tag whenever any part of the body is clicked. I have successfully implemented most aspects of it, but I am facing an issue with the coordinates. The tags are sometimes creat ...

Internet Explorer automatically moves the cursor to the beginning of a textarea when it gains

When trying to insert "- " into an empty textarea, I am facing issues with Internet Explorer. While Firefox and Chrome work perfectly fine by inserting the text as expected, IE causes it to jump to the beginning of the textarea after insertion. Therefore, ...

The HTML website appears to be having trouble scrolling on Android devices, however, it functions properly on both iOS and desktop platforms

Hello everyone, I need help solving an issue with my responsive HTML website. It works perfectly on a desktop browser, but when viewed on a mobile device, it gets stuck and won't scroll. Any suggestions on what might be causing this problem? Thank you ...

Adjusting height in CSS can be done dynamically based on the content within

Currently, I am working on a project where I need the submenu to adjust based on content. The issue is that right now, the submenu has a fixed capacity of 4 items. For example, when you click on 'sale', it displays 4 submenu items perfectly. Howe ...

Display completed survey

I am in the process of developing a mobile app that allows users to answer questions in a questionnaire. Once the questionnaire is completed, the user can save it in LocalStorage. Upon revisiting the page, the user will see all previously answered question ...

How can JavaScript be integrated with Django static URLs?

I have a Django application where I store static images on Digital Ocean Spaces. Displaying these static images in my template is simple:<img>{% static 'images/my_image.png' %}</img> When I inspect the HTML page after loading, I see ...

Arrange the icons in multiple rows to ensure an equal distribution of icons on each row

There are 12 image icons displayed in a row within div elements using display: inline-block. However, when the browser window is resized, I would like the icons to be arranged on two or more rows so that each row contains an equal number of icons. ...

Cannot close the Bootstrap dropdown after selecting an option

I am encountering an issue with a dropdown list that has a select feature using Bootstrap 3.4.1. The problem is that the dropdown remains open after selection and does not close unless I click outside of the list. Here is the HTML code: <div id="c ...

When I attempt to utilize the API, the JavaScript implementation of a <script src=...> element seems to interfere

Within one of my HTML files, I encountered the following line near the top: <script src="//maps.google.com/maps/api/js?key=apikey"></script> The API key is currently hardcoded in this file, but I would like to use a configuration option store ...

When adding classes using Angular's ng-class, CSS3 transitions are not activated

After creating a custom modal directive in Angular, I am encountering an issue with the transition animation not working as expected. Within my directive's isolated scope, there is a method called toggleModal() that toggles the modalState between true ...

What is the best way to check if the items in a dropdown menu are arranged in alphabetical order when using Selenium for

Imagine a scenario where there is a country selection drop-down on a webpage containing all 195 countries listed in alphabetical order. The task at hand is to verify if the countries are indeed arranged alphabetically. What would be the most efficient wa ...

Performing tests with appium and selenium grid can be done by configuring the settings in the ser

My goal is to conduct tests using selenium grid, appium, and serenity with the specified settings in serenity.properties. Initially, I set up a driver class with the local selenium grid URL, which worked successfully. However, when I configure the propert ...

What is the best way to transfer variables to a different page through a pop-up window?

I'm working with a function that converts the Id of the clicked element into a variable, then opens a new window with a different page. How can I access or utilize this variable on the newly opened page? var idToWrite = []; $(function(){ $(".szl ...

What steps should I take to modify the URL using the SELECT tag?

Having a bunch of SELECT tags in place <select id="url"> <option id="url1" >url 1</option> <option id="url2" >url 2</option> </select> <button onclick="go()">GO</button> Followed by the associated scrip ...