0

This is the web inspection

<span jsslot="">
<button class="LkLjZd ScJHi IfEcue HPiPcc KXT7c" jsaction="click:yTqzwd" jsname="HxVe9c" autofocus="">Install</button>
</span>

I want to click on this element using the keyword Execute Javascript. I try like this

Execute JavaScript      document.evaluate("//button[contains(text(),'Install')]",document.body,null,9,null).singleNodeValue.click()

After run test, it is PASS but no any action on web. It's still at the same. Could you please help?


I've already found the solution. According to there are several iframe, so should be select expected iframe before execute above command like this

Select Frame      xpath=//*[@id="obj"]/div[5]/iframe
Execute JavaScript      document.evaluate("//button[contains(text(),'Install')]",document.body,null,9,null).singleNodeValue.click()

1 Answers1

0

Robot Framework: Click Element using Execute JavaScript

Already there is a answer for your question in the above link. Just copied and pasting one of the solution here.

${element_xpath}=       Replace String      ${element_xpath}        \"  \\\"
Execute JavaScript  document.evaluate("${element_xpath}", document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null).snapshotItem(0).click();

Also there are multiple solution in the link, try that.

Manish Kumar
  • 528
  • 5
  • 11