How to Find Button ID


#1

I am not sure where in an element to get the button ID to pass to the click command. For example, where is the ID in the following?:

<a class="icon-area" href="/axis/classroom/techcheck?classId=12590772&amp;returnUrl=/axis/2/class/classroom?id=12590772" target="_blank">
                        <div class="icon enter"></div>
                        <div class="text" data-blurb-id="696207" data-woven="troopjs-ef/blurb/widget@2520">ENTER THE CLASS</div>
                    </a>

I’ve tried several things, and none of them work.


#2

This element has no button ID (only some websites use button IDs, it is up to the web developer to add one, or not).

  • What does recording with Kantu give you as suggested locator (identifier)?
  • You can also try to use visionfind than you do not need any ID or xpath, just an image of the button.

#3

The procedure is to first click on a link which opens a popup, on which I need to click this button.
When recording, it successfully records the click to open the popup, then to click the button on the popup it gives:
Command: click; Target: //*[@id=“popoverStatus335675”]/div[2]/div/div/div[2]/div/div/div[1]/a/div[2] —which doesn’t work.
I tried an extra step of clicking on the popup before the button to make sure it is focussed, but that didn’t work either.

Edit: I also tried using visionfind. Unfortunately, that didn’t work either:

[status]
Playing macro Open Classroom
[info]
Executing: | click | //*[@id=“enterClassWrap”]/div[1]/div/div[2]/a/span[1] | |
[info]
Executing: | visionFind | cQKLPG_dpi_96.png | |
[info]
Executing: | click | #efp | |
[error]
timeout reached when looking for element ‘#elementfrompoint (1602.5, 1149.8333435058594)’
[info]
Macro failed (Runtime 15.44s)


#4

Any chance you can link to the website?


#5

No, it’s a member area for a job I do, so I can’t give out the password.

After some experimentation I found a solution, so I’ll post it here:

{
“CreationDate”: “2018-6-18”,
“Commands”: [
{
“Command”: “open”,
“Target”: “https://axis.englishtown.com/Axis/2/class/teacherschedule#class/”,
“Value”: “”
},
{
“Command”: “click”,
“Target”: “//*[@id=“enterClassWrap”]/div[1]/div/div[2]/a/span[1]”,
“Value”: “”
},
{
“Command”: “waitForPageToLoad”,
“Target”: “id=popoverStatus994075”,
“Value”: “”
},
{
“Command”: “click”,
“Target”: “link=ENTER THE CLASS”,
“Value”: “”
}
]
}

I think the trick was waiting for the popup to load properly.