How to open a new page with a onclick event in the tag?

Hi! The link that I want to click use a onclick event, like, onclick=LoadPage(’/cartorio/…,/detalhes’,[[‘ID’,1234]]);

I have to open several links in the rows of a table
forum1

I’ve used the click command below. It is ok. It is enough to alter the value of the “ num” variable inside a loop to open all the links of the table.
forum2

My problem is that this command don’t open a new window: I would like that when I click on the link, a new page would be created, then I could use the selectwindow command with the tab=0 parameter to return to the first page, table page, and click in the next link.

Below is the result of this link when inspected into the browser.


Thanks,
Leonardo Koblitz

You can extract the URL with storeAttribute |...(xpath here)... | url1 , and then use this variable as input for selectWindow | TAB=OPEN | ${url1}

Hi!
Thank you for your support,

I’ve try to use the storeAttribute command as you suggested, with the same value that I used in the storeXpathCount command, but there was a error message in my script:

“Timeout reached when looking for elemento …”

forum5

forum6

forum7

Bellow is the XPATH expression used in storeAtribute command using the inspect of the bowser and it is OK.

forum8

Read how works storeattribute command please

Your code is wrong, read examples here

https://ui.vision/rpa/docs/selenium-ide/storeattribute

Hi! I have corrected my command, thanks.

xpath=(//a[@class=‘list listDetails’ and @title=‘Detalhes’])[1]@onclick, after that I’ve used de echo command to confirm.

    [echo]   LoadPage('/Cartorios/Oficios/Detalhes',[['ID',3927014]]);

But when I try to use the selectwindow command there was a error.
Error " To open a new tab, a valid URL is needed"

What should I do? Do I have to compound this result with the base URL of the site?

Hi!
When I’ve used the storeAttribute command to return the attribute onclick, defined in the link, it returned “LoadPage(/Cartorios/Oficios/Detalhes’,[[‘ID’,3934854]]);”. When I use this value in the selectWindow command, there is a error. “A valid URL is need”.

Then I’ve found the javascript function “LoadPage” defined in the page to understand how the URL is compound, and to build a valid URL to pass to selectWindow command.
Is this the right way to do this ?

Below is the code of LoadPage function.
Thanks,