Open alekspog opened 7 years ago
Thanks for the feedback.
As I understand, the problem was introduced in https://github.com/SeleniumHQ/selenium/commit/09dab5afe5280476290f9cc43d51269aac672853 and https://github.com/SeleniumHQ/selenium/commit/18432f5b0fb4fcd477fec1f02914c9ddd8c72793.
Webium uses remote WebElement
class by default and obviously its instance is not recognized as FirefoxWebElement
instance.
For now I can suggest a couple of dirty workarounds:
from selenium.webdriver.firefox.webelement import FirefoxWebElement
# ...
suggest1 = Find(FirefoxWebElement, by=By.CSS_SELECTOR, value='.card-section .brs_col:nth-child(1) ._e4b:nth-child(1) a')
or you can patch the expected class after driver initialization:
from selenium.webdriver.remote.webelement import WebElement
from webium.driver import get_driver
# ...
get_driver()._web_element_cls = WebElement
We can do some patch in webium
, but I think this probably should be fixed in selenium
.
Will try to work on this.
Thanks!
Both workarounds are working, hope selenium team are going to fix this problem in the future.
This issue has been resolved. Please upgrade to the latest versions of selenium
and geckodriver
.
I have a page with elements which are out of the visible browser area and I need to scroll these elements to view. I try to use
execute_script("return arguments[0].scrollIntoView(true);", element)
method but it fails for Firefox withTypeError: <selenium.webdriver.remote.webelement.WebElement (session="732d3ce1-eaed-494c-b441-b29fdb9e02e3", element="e9db3f8c-9836-4c68-a9c9-364066a3d76e")> is not JSON serializable
. However, it works fine in Chrome.It seems the root of this problem is described in https://github.com/SeleniumHQ/selenium/issues/2666#issuecomment-289146650. "the problem might have been that the reporter was using a custom subclass of WebElement with Firefox." - it means it can happens for the same reason for Webium which use also custom subclass when you use Selenium 3.
How do you handle this problem in your projects? Is there chance that you can implement something for Webium similar to this patch?
This example can reproduce the problem. selenium==3.4.1 webium==1.2.1 geckodriver is 0.16