applitools / Eyes.Selenium.JavaScript

Applitools Eyes SDK For Selenium JavaScript WebDriver
Other
18 stars 18 forks source link

recognize wedriver.WebElements correctly #45

Closed ttdmayshark closed 6 years ago

ttdmayshark commented 6 years ago

This needs to be merged for eyes.checkRegionByElement and similar functions to work. Otherwise, trying to do this:

yield eyes.checkElementByRegion(someWebdriverWebElement), 'some tag');

raises an error:

 Error {
    message: 'Unsupported region type: object',
  }

One further note: this commit looks like what broke it, so if there was a reason there perhaps you have more context than I do: https://github.com/ttdmayshark/Eyes.Selenium.JavaScript/commit/d20dabe9ab6cc6b77201f15e3c21eee10e6be4b3#diff-5a3ba2410ee7605d890a1b491c9ad788L418

astappiev commented 6 years ago

It can cause to additional unhandled errors during extracting region from an element. Eyes wrapper for WebElement contains some additional methods which used in our SDK later.

To get EyesRemoteWebElement instead of WebElement, you should use a driver which returns after eyes.open() method, the driver contains a lot of methods starting from findElement... all of them returns wrapped element which acceptable by the method.

ttdmayshark commented 6 years ago

okay @astappev -- the documentation in the library still says that WebElement is acceptable. Is there updated documentation somewhere? Do you have example code?

astappiev commented 6 years ago

There is example how to use new check interface to capture region by element. I will suggest this method.

Other possible solutions eyes.checkRegionByElement(By.id("overflowing-div")) eyes.checkRegionByElement(driver.findElement(By.id("overflowing-div"))) in the case driver object should be object resolved after eyes.open method, like there.

ttdmayshark commented 6 years ago

Okay, thanks. Note that the method docs here appear to be out of date: https://github.com/applitools/Eyes.Selenium.JavaScript/blob/master/src/Eyes.js#L583

I'm set, feel free to close this

danielputerman commented 6 years ago

Thanks @ttdmayshark