Looking for assistance with automated web testing using selenium

I am currently using Selenium to carry out testing on a web application, but I have encountered an issue. One of the nodes that needs to be clicked has a value that constantly changes upon startup.

For example:

click css=#f0012 > ins.jstree-icon

At startup, the letter before 0012 is randomly selected from a range of letters (a-z). This means that every time my Selenium script runs, I either need to extract this character or simply reference the number 0012 so that the program can identify which button to click.

I am really struggling with this problem, so any assistance would be greatly appreciated.

Answer №1

Try using this method:

click css=[id$='0012'] > ins.jstree-icon

By utilizing the $= selector, you can target elements that end with "0012".

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

Python Selenium: Typing speed is too slow

When attempting to fill out a form quickly using element.send_keys("Anything"), I am finding that it takes significantly longer than expected. I have experimented with various Chromedriver versions, but the issue persists. Are there any possible reasons wh ...

What is the best placement for a variable to be incremented by 1 within a loop function?

I'm struggling with a particular piece of code: if storagetypecheck1 == "Virtual": def storagecheck(): d = 1 dforid = str(1-d) while d <= int(numcount): storageidprefix = "specimen" + "[ ...

Selenium is unable to locate an element using Jquery

sel.add_script( sel.get_location(), "jquery.js") #I am getting u'fd6c42bcc770ca9decc4f358df3688290a4257ad' idOfResultWithSomeImage=sel.get_eval("window.jQuery('#result').find('img').filter('[alt=SeleImage]') ...

Is it possible for a dropdown to span 100% of the width

http://jsfiddle.net/gL1xynzr/ Is there a way to style a dropdown menu with the following properties: width: 100%; max-width: 440px; I am planning to include 4 of these dropdowns in one CSS table row to ensure they fit horizontally on mobile phone portra ...

No element was discovered matching the specified name

I'm facing a challenge in locating an element as I keep receiving an error stating that the element cannot be found Here is my code: Dim bot As WebDriver Set bot = New WebDriver bot.Start "chrome" bot.Get "http://.. ...

Utilize SVG background with transparent text for a clear view of surrounding content

I'm looking for a way to overlay a video with a semi-transparent black div that includes text and a button, while still allowing users to see the video playing behind it. I previously achieved this using a PNG image but now need to apply the effect to ...

Looking for ideas on how to use Python and Selenium for web scraping?

Input Field: <input type="text" auto_complete_item_format="<b xmlns=&quot;none&quot;>[_full_name]</b>" auto_complete_display_field="_full_name" auto_complete_id_field="suburb_id" auto_complete_ ...

Having trouble opening the uiautomatorviewer tool

When trying to launch the UI Automator Viewer tool via command prompt, I encountered the following error: C:\Users\getta\AppData\Local\Android\Sdk\tools\bin>uiautomatorviewer -Djava.ext.dirs=..\lib\ ...

What is the best way to adjust the width of the <span> element in an Angular application?

This snippet showcases a piece of HTML code. <div class="col-md-8"> <span class="label">Product Name</span> <span> <mat-form-field> <input matInput formControlName="productName"> </mat-form ...

Hide and reveal images on hover by using multiple images or links on a single webpage

Despite my efforts, I haven't been able to find exactly what I'm looking for. My current setup involves an image/content slider powered by Awkward Showcase. Within each slide, I want to incorporate a mouse-in/mouse-out effect that switches and hi ...

Ways to remove the final line from extracted data using Python and Selenium

text = driver.find_elements(By.XPATH,'//div[@id="content"]/p') We have retrieved multiple paragraphs from the content, stored as text[0], text[1]..... and so on. The total number of paragraphs may vary each time. The objective now is t ...

Display or conceal several elements upon hover using JQuery and HTML

Here is the current progress I have made: <div style = "position: relative;"> <a href = "#games"> <div class="sidenavOff"> <img src = "images/card_normal.png" /> <img src = "images/category_icons/icon_games.png" style = "positio ...

Steps for splitting a numbered list and adding an image above each item:

I have a challenge I'm trying to tackle with my list: My goal is to create a long, numbered list that is divided into different sections I also want to include an image within each list item and have it display above the numbered title of the sectio ...

The upper border is missing from the middle div in the presence of three divs

I am currently working on a new project using HTML, CSS, and Bootstrap. However, I have encountered a problem. I have created a box with a border all around it, and when I hover over this box, an image appears inside of it. By default, the inside of the bo ...

Is it possible to sanitize user input without relying on !important?

Utilizing wp_editor, I have implemented a front-end form on my WordPress website for users to post without accessing the admin section. Although it is functional, there is a concern that users may copy and paste content with inline styles that could disrup ...

Website design with a central vertical alignment and a subtle shadow effect

Yesterday I inquired about a website design featuring a shadow, but I have since created a better example and would like to pose the question again. My requirements are as follows: A vertically centered website; A shadow on the content block which may h ...

Clear HTML

Is there a way to create a 'div' element in an HTML document and adjust the background transparency using CSS or Javascript/JQuery in order to achieve a look similar to Simple Calendar Widget or Glass Widgets from Android? I have tried using the ...

Guide on how to position the icon for the Ant Design datepicker before the input selector rather than after

Looking for a way to set the icon with or without a pseudo element for Ant Design, I've tried a method that isn't working. .ant-picker-input > input::before { content: url('../../public/assets/calendar.svg') !important; margin-r ...

vertical lines alongside the y-axis in a d3 bar graph

https://jsfiddle.net/betasquirrel/pnyn7vzj/1/ showcases the method for adding horizontal lines along the y axis in this plunkr. I attempted to implement the following CSS code: .axis path, .axis line { fill: none; stroke: #000; } I am lo ...

Adjust the content to expand and occupy the entire height using Material UI cut-off Drawer

I am using the provided Material UI code for a persistent clipped drawer, but I am encountering an issue with the content height. I have set the background of the content section to red in my demo sandbox to showcase the problem. My goal is for the content ...