# Newbie question about RPA selenium click link

**URL:** <https://forum.robotframework.org/t/newbie-question-about-rpa-selenium-click-link/5177>\
**Category:** RPA\
**Created:** [14 January 2023 14:26 UTC](https://forum.robotframework.org/t/newbie-question-about-rpa-selenium-click-link/5177 "2023-01-14T14:26:29Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![pebbles](https://avatars.discourse-cdn.com/v4/letter/p/f4b2a3/32.png) [@pebbles](https://forum.robotframework.org/u/pebbles)\
**Post date:** [14 January 2023 14:26 UTC](https://forum.robotframework.org/t/newbie-question-about-rpa-selenium-click-link/5177/1 "2023-01-14T14:26:29Z")

</div>

Hey Everyone,  
This is my first post.  
I just started learning RPA, I did already automated some actions, but for the love of god I can’t figure out how to click a dynamically generated link.

In few words, in this intranet like website, I have a section where I can query for specific reports, when i click on query, a link gets generated.  
When I do inspect this link i get this:

Open file …/Queries/Qry123411.csv generated 10/01/2023 13:55

I Am using the RPA.Browser.Selenium Library.

I have tried all sorts of combinations, what I do not get is why a simple click link href:“…/Queries/Qry123411.csv” does not work and returns link not found.

Any help is very appreciated  
Thanks,  
Pebbles

---

<div class="post-metadata">

**Author:** ![pebbles](https://avatars.discourse-cdn.com/v4/letter/p/f4b2a3/32.png) [@pebbles](https://forum.robotframework.org/u/pebbles)\
**Post date:** [14 January 2023 14:30 UTC](https://forum.robotframework.org/t/newbie-question-about-rpa-selenium-click-link/5177/2 "2023-01-14T14:30:14Z")

</div>

`<a href="../Queries/Qry123411.csv" target="Qry123411"> Open file ../Queries/Qry123411.csv generated il 10/01/2023 13:55</a>`

Sorry, this is the inspected content

---

<div class="post-metadata">

**Author:** ![HelioGuilherme66](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/helioguilherme66/32/34_2.png) [@HelioGuilherme66](https://forum.robotframework.org/u/HelioGuilherme66)\
**Post date:** [14 January 2023 17:40 UTC](https://forum.robotframework.org/t/newbie-question-about-rpa-selenium-click-link/5177/3 "2023-01-14T17:40:58Z")

</div>

(not that I have experience with that problem, but here are my thoughts)

That does not seem to be a valid link.  
Maybe It should be `<a href="file:///` (it is missing the protocol) or `<a file=`

The relative path is the point here. The server should know to resolve it when you click the link.

---

<div class="post-metadata">

**Author:** ![damies13](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/damies13/32/623_2.png) [@damies13](https://forum.robotframework.org/u/damies13)\
**Post date:** [15 January 2023 10:34 UTC](https://forum.robotframework.org/t/newbie-question-about-rpa-selenium-click-link/5177/4 "2023-01-15T10:34:28Z")

</div>

Hi Giacomo,

I usually recommend to anyone new to test automation to learn how to construct xpaths, this is a skill that you’ll find useful as this standard selection method is used by many test automation tools not just Robot Framework. A good starting point is this [XPath Tutorial](https://www.w3schools.com/xml/xpath_intro.asp)

In your case, you just need to identify what parts of the link remains constant so you can use that to identify the link.

Here are some examples that could work for you:

```python
    Click Link //a[contains(@href, ".csv")]

```

```python
    Click Link //a[contains(@href, "Queries")]

```

```python
    Click Link //a[contains(text(), "generated il")]

```

```python
    Click Link //a[contains(text(), "Open file")]

```

Hope that helps,

Dave.

---

<div class="post-metadata">

**Author:** ![pebbles](https://avatars.discourse-cdn.com/v4/letter/p/f4b2a3/32.png) [@pebbles](https://forum.robotframework.org/u/pebbles)\
**Post date:** [16 January 2023 08:10 UTC](https://forum.robotframework.org/t/newbie-question-about-rpa-selenium-click-link/5177/5 "2023-01-16T08:10:35Z")

</div>

Hey, thank you both for your answers!  
I saw the tutorial, thank you for that, I now understand the logic behind xpath.

Unfortunately, none of your suggestions works, I suppose this link gets generated in a wierd way.  
I say that because on other elements on the webpage, using dev tools I can exctract a working xpath but if I do the same on that particular element all I get is this:

/html/body/table/tbody/tr/td/a

What you suggested should work in theory  
☹

---

<div class="post-metadata">

**Author:** ![damies13](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/damies13/32/623_2.png) [@damies13](https://forum.robotframework.org/u/damies13)\
**Post date:** [17 January 2023 00:00 UTC](https://forum.robotframework.org/t/newbie-question-about-rpa-selenium-click-link/5177/6 "2023-01-17T00:00:32Z")

</div>

Hi Giacomo,

something to check in dev tools, if the link in a frame/iframe? you might need to use [Select Frame](https://robocorp.com/docs/libraries/rpa-framework/rpa-browser-selenium/keywords#select-frame) before clicking the link?

Dave.

---

<div class="post-metadata">

**Author:** ![\_daryl](https://avatars.discourse-cdn.com/v4/letter/_/45deac/32.png) [@\_daryl](https://forum.robotframework.org/u/_daryl)\
**Post date:** [2 February 2023 22:12 UTC](https://forum.robotframework.org/t/newbie-question-about-rpa-selenium-click-link/5177/7 "2023-02-02T22:12:00Z")

</div>

Hi Giacomo

Guessing “link not found” is what click link returns

Something worth checking, but you are prefixing the locator if your using an xpath that was suggested above?  
`Click Link xpath://a…`  
I believe if you don’t provide it from how it reads it will check against those stated in the documentation with xpath isn’t one unless you tell it:  
[https://robotframework.org/SeleniumLibrary/SeleniumLibrary.html#Click%20Link](https://robotframework.org/SeleniumLibrary/SeleniumLibrary.html#Click%20Link)

Oh also something worth a try if you haven’t after the above, you may need to set a wait until if this link is dynamically generated.

Thanks
