1

I am trying to automate UI using karate dsl version 0.9.6. Below is the steps I am trying to perform

* driver "https://next--storybookjs.netlify.app/official-storybook/?path=/story/addons-storyshots--block"
* waitFor('#storybook-preview-iframe').switchFrame()
* mouse().move('#root div.css-a32zs').go()
#* click('#root div.css-a32zs')
* delay(4000)
* screenshot()
* switchFrame(null)

I am trying to perform a mouse hover or click on the element "#root div.css-a32zs" which is inside iframe. But the karate is not interacting with element. I am able to collect any text or element inside the iframe but not able to interact with them. I tried above scenario using selenium-java and it is interacting with the element.

Please suggest if I am doing it wrong way or a solution for the above.

Well to update karate is awesome tool and able to test 150 plus UI test cases so far and still counting.

1 Answers1

0

I found that this works:

* mouse().move(400, 400).go()

So I think what is happening is the position is relative to the current frame, But the left-nav is adding a few pixels.

See if you can figure out how Selenium solves this and suggest or better still contribute code.

EDIT: we'll make some enhancements to Karate so that you can do this in the next version:

* def frame = waitFor('#storybook-preview-iframe')
* def offset = frame.script('_.getBoundingClientRect().left')
* frame.switchFrame()
* mouse('.css-a32zs').offset(offset, 0).go()
Peter Thomas
  • 54,465
  • 21
  • 84
  • 248