How to click on anchor <a> tag from Canoo webtest?

368 Views Asked by At

Our team replaced a submit button with the following anchor tag:

<a class="l-btn" onclick="onFormSubmit(this.form)" Style="width: 80px; text-align:center;"> 
<span class="l-btn-left"> 
<span class="l-btn-text">Save</span> 
</span>
</a>

I retrieved xpath from XPather, and tried to use from canoo webtest to click on it, but received "failed: Link not found".

Does anyone know how to simulate click on the above?

Thanks.

2

There are 2 best solutions below

0
On
<clickLink xpath="//a[@class='l-btn']" description="Click first a tag with class l-btn" />

See clickLink documentation

0
On

clickLink xpath="//a[contains(@onclick,'onFormSubmit')]

description="click link with onclick property that contain the word
onFormSubmit"

will look for the link with xpath property onclick that contain a value 'onFormSubmit'