How do I get dynamic button id as text with partial match?


#1

When using verifyElementPresent, I get True return value.
But when I try to extract the id as text using the following code, it shows the following in the Log =>

  • [info] Executing: | sourceExtract | xpath=//*[contains(@id, “10.30-13.00”)] | match1 |

  • [error] Missing * or REGEX in sourceExtract. Extracting a plain text doesn’t make much sense

I need to know the correct code to extract the id by partial match from the page source code.
I need to get as text by eliminating this part "10.30-13.00” of the dynamic id; remainder will be something like 55 or 36, a number.

I am stuck at this for over 2 months. Please help and please explain, I am NOT an expert. :slight_smile:


#2

Can you post a link to the website? Or at least a HTML code snippet?


#3

The problem is that the page gives access to the radio button for two minutes tops. at 01:00:00 and then it does not load the page with the radio button (our target with the dynamic / changing id). It shows an overlapping message.

The id starts with something like this : id=10.30-13.0050 and when users have clicked and booked, it reduces the last two digits of the id by 1 until it reaches 0 or 00 (I don’t know). So the part “10.30-13.00” remains constant.

When I recorded each step, the clicking of the radio button was captured in Kantu code as follows, in the form of two commands :

COMMAND : type
TARGET : id=10.30-13.0050
VALUE : 50

COMMAND : CLICK
TARGET : id=10.30-13.0050

Should I save the page as html single file and then post it?


#4

Actually, I should have asked first: Why do you need the button ID? Just to click on it, or do you need the ID for something else?


#5

Just using click or ckickAndWait or even XClick along with partial match using XPATH, it does not work.

As shown in the recorded steps, I think the appended number of slots free (the number starting at 80 or 50 and then decreasing by one for every customer) is to be entered as VALUE with type COMMAND.
I think I have to BOTH type and click the radio button in terms of Kantu code.
The website has made it a bit difficult to prevent automation.

I am not even sure my XPATH expression or partial match finder code is correct.

I can give you any code that I am using so that you can check whether it’s okay or not.

And I’m posting the HTML file that I saved just now : https://drive.google.com/open?id=18crhW-vuyMIOV2k5XRGPTqY_wJaX2ecP

There are two separate folders, one with the complete set of files and the other as a single html file, download whichever you may need.

I just found this in the elements :

<td><input type="radio" name="timeForDisp" id="10.30-13.000" value="0" disabled="disabled" onclick="enablebookslotbtn(this.id)"><label for="10.30-13.000">0</label>
&nbsp;</td>

#6

Thanks. Can you also post a website screenshot and mark the element to be clicked? (So I know I am looking at the right place)


#7

Sure, I will do it today after the web page is accessible again.


#8

I have added a folder “Screenshots” with unedited and edited screenshots. Please view them by following the previously posted link.