Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webdriver module missing moveToElement #2840

Closed
javigomez opened this issue Feb 24, 2016 · 5 comments
Closed

Webdriver module missing moveToElement #2840

javigomez opened this issue Feb 24, 2016 · 5 comments

Comments

@javigomez
Copy link
Contributor

Long story short: since Selenium 2.48 there is a new addition causing a lot of trouble. Is the known error:

[UnknownServerException] Element is not clickable at point (XXX.XXXXXXXX, YY.YYYYYY). Other element would receive the click:

this happens when you have a floating element over the element that you want to click:

capture 2016-02-03 at 17 43 53

You can seen the whole issue described at: SeleniumHQ/selenium#1202

I have tried with this suggestion (SeleniumHQ/selenium#1202 (comment)):

screen shot 2016-02-24 at 17 48 30

Adding this in my acceptance.suite.yml:

            capabilities:
              elementScrollBehavior: '1'

But doesn't seem to do the trick.

I was now trying the advise at SeleniumHQ/selenium#1202 (comment). And is to use:

screen shot 2016-02-24 at 17 47 02

And I have noticed that despite that the Facebook Webdriver implements the function:

https://github.com/facebook/php-webdriver/blob/community/lib/Interactions/WebDriverActions.php#L170-L186

The Codeception Webdriver module does not implement it.

I was wondering how to implement it. It should be something like adding this:

    public function moveTo($selector)
    {
        $el = $this->findField($selector);
        $this->webDriver->getMouse()->moveToElement($el);
    }

at: https://github.com/Codeception/Codeception/blob/2.1/src/Codeception/Module/WebDriver.php

But I'm missing something, because I get: FATAL ERROR. TESTS NOT FINISHED. Call to undefined method RemoteMouse::moveToElement()

Any advise on how to implement this?

Thanks ^_^

@Naktibalda
Copy link
Member

moveToElement is not a method of RemoteMouse, it is a method of WebDriverActions.

The only method currently using WebDriverActions is dragAndDrop: https://github.com/Codeception/Codeception/blob/2.1/src/Codeception/Module/WebDriver.php#L2005

@DavertMik
Copy link
Member

@javigomez I hope you can get it implemebted by following an advice of @Naktibalda
If so, please send PR into 2.1 branch

Btw, In CodeceptJS we have scrollTo method. I agree we need to have smeth like it in Codeception

@javigomez
Copy link
Contributor Author

Oh I missed that! thanks @Naktibalda for the advise 😅

Yes, @DavertMik I will try to implement today and I'll send news.
Naming it scrollTo like you do in CodeceptJS sounds to me much better than moveTo or moveToElement. I will use that name.

@javigomez
Copy link
Contributor Author

Also we could create a function like this in codeception: https://github.com/gterre/stuff/blob/master/JavascriptUtils.java#L155-L174 adding it to the Click command.

So when I do $I->click we always check if the element is clickable before clicking on it, otherwise we raise an error.

@javigomez
Copy link
Contributor Author

#2882 should close this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants