Click on element

7 posts, 1 answers
  1. Vlad
    Vlad avatar
    5 posts
    Member since:
    Feb 2013

    Posted 11 Feb 2013 Link to this post

    Hi,

    how can i click on element found by xpath?

    app.ActiveBrowser.NavigateTo("link");

    app.ActiveBrowser.Find.ByXPath("//span[contains(text(),'foo')]"); //this element
  2. Boyan Boev
    Admin
    Boyan Boev avatar
    1045 posts

    Posted 11 Feb 2013 Link to this post

    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
  3. Vlad
    Vlad avatar
    5 posts
    Member since:
    Feb 2013

    Posted 12 Feb 2013 Link to this post

    I can't call the click event. Please, see my screenshot. What should I do?
  4. Answer
    Boyan Boev
    Admin
    Boyan Boev avatar
    1045 posts

    Posted 12 Feb 2013 Link to this post

    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
  5. Vlad
    Vlad avatar
    5 posts
    Member since:
    Feb 2013

    Posted 12 Feb 2013 Link to this post

    Great! Thanks!
  6. Jaime
    Jaime avatar
    60 posts
    Member since:
    Mar 2013

    Posted 09 Jul 2015 in reply to Boyan Boev Link to this post

    Could you provide a link to the possible Html types?

    Thanks!

  7. Boyan Boev
    Admin
    Boyan Boev avatar
    1045 posts

    Posted 14 Jul 2015 Link to this post

    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
     
Back to Top