ChromeFindElements -is this name ok?

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
bbrink
Pro Scripter
Posts: 70
Joined: Thu Dec 31, 2009 2:36 am
Location: Minnesota
Contact:

ChromeFindElements -is this name ok?

Post by bbrink » Sun Apr 24, 2022 10:27 pm

Hi,

Using the new chrome function ChromeFindElements, developer tools inspector says the element name is "Search:" without the quotes.

Let>MyValue=Search:
ChromeFindElements>session_id,name,%MyValue%,search_elements
//returns count of 0.

Is it possible the colon is giving me grief and if so, how would I escape that?

If I need to take a different approach I noticed that with the element highlighted I can copy xpath or full xpath.

xpath is
#datatable-responsive_filter > label > input

full xpath is
/html/body/div[1]/div[3]/div/div/div[3]/div[1]/div[3]/div[1]/form/div[6]/div/div[1]/div[2]/div/label/input

If tried using xpath like this:
ChromeFindElements>session_id,xpath,//*[@id="datatable-responsive_filter"]/label/input,info_elements

but it complained about unquoted string in JSON. I am in over my head.

Thank you,

Bob

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1390
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: ChromeFindElements -is this name ok?

Post by Dorian (MJT support) » Mon Apr 25, 2022 8:29 am

Hi Bob,

The colon shouldn't be the issue here. If the html is something like this :

Code: Select all

<input type="text" name="Search:">
Then both of these work. el_count / elres should be 1 in each case, showing 1 match was found, and the form field will be populated :

Code: Select all

ChromeFindElements>session_id,name,Search:,el
let>elres=el_count
ChromeSetElementValue>session_id,el_1,test

Code: Select all

ChromeFindElements>session_id,xpath,//input[@name='Search:'],el
let>elres=el_count
ChromeSetElementValue>session_id,el_1,test
Some things to note :
1. It's case sensitive, so if you were to use search: instead of Search: your el_count would be 0. It seems OK to use @Name instead of @name when using xpath though, but doing that when using name are a strategy also results in a 0.

2. If it's in a frame, you'll need to use ChromeSwitchFrame first.

3. If it's in a popup, you'll often need to use ChromeSwitchWindow first.
Yes, we have a Custom Scripting Service. Message me or go here

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts