Forum Discussion

mgroen's avatar
mgroen
Frequent Contributor
12 years ago

XPath in Keyword Tests

Hi,

I want to Xpath expressions on difficult-to-find objects, in my Keword tests.



Problem is, I do not know how to incorporate Xpath expressions in Keyword tests.



For example, I want to click on an image on the page, and this image is called "zoom_gif".



In my framework, I use Keyword tests (running Code Snippets whenever is needed).

How can I incorporate the FindChildbyXPath and/or EvaluatebyXpath expressions in my keyword tests, to click on the above mentioned button (image), and try to use as little coding as possible?



Thanks

13 Replies

  • mgroen's avatar
    mgroen
    Frequent Contributor
    Hi Alexis,



    I have done some "spying" the object again (using Chrome developer toolkit), and when I choose to Copy as Xpath I get exactly the same path as before:



    //*[@id="ic_maintab"]/div[2]/div/div/div/div[2]/div/div/div[1]/div/div/table/tbody/tr/td/div/div[14]/div/table/tbody/tr/td[2]/a/img



    So, I conclude this path remains the same....
  • mgroen's avatar
    mgroen
    Frequent Contributor


    Tanya,

     



    I am using VBScript as scripting language (however, I am  using Keyword testing as much as possible, and use the "Run Code Snippet" feature to run small pieces of scripts...



    What would the correct syntax be for running it in VBScript language?



    Thanks,



    Mathijs