cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
soumiya
Helper I
Helper I

Dynamic selector change

This is the selector I use to select data from a drop down each time when page get reloaded the 856 value alone gets changed with some random value. I tried replacing 856 as * and tried but still error no element found. Please do help  me solution.


div[Id="18:856;a"] > div > div > a[Class="select"]

 

9 REPLIES 9
HellitonWoo
Regular Visitor

After opening the selector with "Visual Editor", you can try to change the "Operator" of certain "attribute"

This is a screenshot of selectors for "Windows Calculator". You can see that I changed "Equal to" to "Start with" and this still works

 

HellitonWoo_1-1602682088365.png

HellitonWoo_2-1602682135530.png

 

 

 

If this "ID" is very unstable, I'd suggest you tick it off and use another attribute.

adijain
Microsoft
Microsoft

Hello @soumiya, In addition to what @HellitonWoo mentioned, you can also directly customize the selector to any of the following:

  •  div[Id^="18:"] > div > div > a[Class="select"] - this will target the div element which has the Id attribute starting with "18:".
  • div[Id*="18:"] > div > div > a[Class="select"] - this will target the div element which has Id attribute containing "18:"
  • div[Id@="18:.*?;a"] > div > div > a[Class="select"] - this will target the div element which has id attribute matching "18:*a", here regular expression is applied.

Thanks for your reply....

Still its not working throwing same error element not found 

Thanks for your reply....

Still its not working throwing same error element not found

Hello @soumiya, could you please let us know the webpage URL where the element exists? It will help us identify patterns in specific attributes of the target element which do not change dynamically. 

We are trying to automate salesforce Lead process

https://ap16.lightning.force.com/lightning/o/Lead/new

 

The above URL is used for automating

 I have attached the screenshot of where I need to automate so in this i need to fill the most of the field. In selector only a part of Id changes for all field i had identified and tried to change it as dynamic but nothing works.

Capture.PNG

 

div[Id="18:846;a"] > div > div > a[Class="select"]

this is the selector for first dropdown field here 846 will alone be changing for each entry so i tried with start with option, contains option and lot more but still nothing helped to achieve my task.

Please do help with solutions that would be possible for this selector   

 

Thanks and Regards

Soumiya

Hi @soumiya 

 

You could also try using the "has" selector:

https://support.softomotive.com/support/solutions/articles/35000089128-how-to-use-the-has-css-select...

 

You could try several approaches, the following one may be helpful:

div:has(a.select) > div > div > a[Class="select"]

 

HEATFreight
Kudo Collector
Kudo Collector

.

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Top Kudoed Authors
Users online (4,992)