Dropdown Box in Chrome

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
fightcancer
Macro Veteran
Posts: 247
Joined: Fri Apr 15, 2005 8:32 am

Dropdown Box in Chrome

Post by fightcancer » Fri Jun 18, 2021 5:28 am

I'm trying to get MS to select an option from the "Search By City Name" dropdown box in the link below but I'm not having any luck.
https://www.lkm.org/general/custom.asp? ... torySearch

I was using this line, but the res value is always blank.

Code: Select all

ChromeFindElements>session_id,xpath,/html/body/table[1]/tbody/tr[2]/td[2]/form/div/div/select,res
Any help appreciated. Thanks in advance!

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

Re: Dropdown Box in Chrome

Post by Dorian (MJT support) » Fri Jun 18, 2021 9:08 am

If you right click on that element you can see it's in a frame. "View frame source" often gives us all the information we need to switch to that frame. So we find frames, switch frames, interact, switch back. Like this :

Code: Select all

//Find the frame using xpath
ChromeFindElements>session_id,xpath,//iframe[@src='https://lkm.continuum.host/directory/search.php'],elements
 
//switch browsing context to this frame
ChromeSwitchFrame>session_id,element,elements_1,res

//Find element
ChromeFindElements>session_id,xpath,//select[@name='ID'],el

//Make selection
ChromeSetElementValue>session_id,el_1,City of Abilene

//Switch frame back
ChromeSwitchFrame>session_id,index,null,res
Yes, we have a Custom Scripting Service. Message me or go here

fightcancer
Macro Veteran
Posts: 247
Joined: Fri Apr 15, 2005 8:32 am

Re: Dropdown Box in Chrome

Post by fightcancer » Tue Jun 22, 2021 2:38 pm

I had no idea about frames, but that helped so much! Many thanks!!

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