1

I am trying to click on a button using this command: Then submit().click("//input[@id='myButton' and @type='button' and @value='CLICK HERE']")

This works fine when I set up the driver on my local machine: * configure driver = { type: 'chrome', showDriverLog: true}

However, on the remote machine, it doesn't work. * configure driver = { type: 'chromedriver', start: false, webDriverUrl: 'https://mygrid.com' }

I've tried multiple things such as: And locate("//input[@id='myButton' and @type='button' and @value='CLICK HERE']").exists -> This returns true

This does scroll down so the button is visible(I can see from screenshot) And script("//input[@id='myButton' and @type='button' and @value='CLICK HERE']", '_.scrollIntoView()') And click('//input[@id='myButton' and @type='button' and @value='CLICK HERE']')

The action of clicking on the button doesn't throw an error in Karate, however it doesn't actually get done when on a remote driver..

DevOpsUj
  • 31
  • 2
  • there can be subtle browser differences. this needs research which perhaps only you are in a position to do. if you can replicate this following this process, then something can be done: https://github.com/karatelabs/karate/wiki/How-to-Submit-an-Issue – Peter Thomas Jul 22 '23 at 04:06

1 Answers1

0

For that step try using a mouse('locator').click() operation.

Peter Thomas
  • 54,465
  • 21
  • 84
  • 248
  • That doesn't work – DevOpsUj Jul 24 '23 at 00:49
  • @DevOpsUj help us replicate the problem – Peter Thomas Jul 24 '23 at 03:05
  • I'm not sure how but I did find that chromedriver can sometimes cause issues when clicking on element. Is it possible to replicate the following code using karate: https://stackoverflow.com/questions/17112363/selenium-chrome-driver-click-method-not-always-clicking-on-elements – DevOpsUj Jul 24 '23 at 13:04
  • @DevOpsUj just took a quick look. if you mean how to execute JS in a page, refer: https://stackoverflow.com/a/60800181/143475 – Peter Thomas Jul 24 '23 at 13:17