Thanks all for the sugestions. I'm definitely on the right track now
using xpath. I do want to make the links into a parameter as I can get
the values from the database. They originate as an array which I then
convert to a string. Perhaps my syntax is incorrect? Thanks again for
your help.
This works: @driver.find_element(:xpath, '//a[contains(@href,
"site_12")]').click
Does not work:
step 1. link = "site_12" (this is a string now)
step 2. @driver.find_element(:xpath, '//a[contains(@href,
link)]').click
On Jan 5, 1:19 am, Jayaraman - Inspired to become Software Architect
<
electrical.i...@gmail.com> wrote:
> I would suggest to go with the xpath.Try to locate the first link using the
> below xpath
>
> //a[contains(@href,'site_12)]. For Other links, replace site_56, site_23
> in place of site_12 respectively.
>
> In order to make a reusable one, locate the link with the above xpath but
> pass the number i.e 12 [For first link],56 [For second link],23 [For third
> link] as a parameter.
>
> Ex:
> //a[contains(@href,'site_${Parameter})].
>
> Best Regards,
> Jayaraman.
>