This is a migrated thread and some comments may be shown as answers.

Click on element

6 Answers 116 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Vlad
Top achievements
Rank 1
Vlad asked on 11 Feb 2013, 02:05 PM
Hi,

how can i click on element found by xpath?

app.ActiveBrowser.NavigateTo("link");

app.ActiveBrowser.Find.ByXPath("//span[contains(text(),'foo')]"); //this element

6 Answers, 1 is accepted

Sort by
0
Boyan Boev
Telerik team
answered on 11 Feb 2013, 02:23 PM
Hi Vlad,

Thank you for contacting us. 

You have two options:

1. You can call the click event directly with the find expression:

app.ActiveBrowser.Find.ByXPath("//span[contains(text(),'foo')]").Click();

2. You can store it in a object and call the click event after that:

var element = app.ActiveBrowser.Find.ByXPath("//span[contains(text(),'foo')]");
elelemnt.Click();

Let me know if this helps.Kind regards,
Boyan Boev
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Vlad
Top achievements
Rank 1
answered on 12 Feb 2013, 07:27 AM
I can't call the click event. Please, see my screenshot. What should I do?
0
Accepted
Boyan Boev
Telerik team
answered on 12 Feb 2013, 08:36 AM
Hi Vlad,

You should define what kind of control you are looking for (see attached screen shot). It seems you are looking for a span, so try out this code please:

app.ActiveBrowser.Find.ByXPath<HtmlSpan>("//span[contains(text(), 'Управление заявками')]").Click();


Hope this helps.

Greetings,
Boyan Boev
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Vlad
Top achievements
Rank 1
answered on 12 Feb 2013, 10:48 AM
Great! Thanks!
0
jwize
Top achievements
Rank 1
answered on 10 Jul 2015, 02:09 AM

Could you provide a link to the possible Html types?

Thanks!

0
Boyan Boev
Telerik team
answered on 14 Jul 2015, 01:35 PM
Hi Jaime,

Here is the list of all html controls.

Hope this helps.
 
Regards,
Boyan Boev
Telerik
 
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
 
Tags
General Discussions
Asked by
Vlad
Top achievements
Rank 1
Answers by
Boyan Boev
Telerik team
Vlad
Top achievements
Rank 1
jwize
Top achievements
Rank 1
Share this question
or