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

Provide scrollIntoView to workaround problems in Firefox (equivalent to com.codeborne.selenide.commands.ScrollTo) #649

Closed
mseele opened this Issue Dec 22, 2017 · 7 comments

Comments

Projects
None yet
4 participants
@mseele
Contributor

mseele commented Dec 22, 2017

The problem

Let's provide a com.codeborne.selenide.SelenideElement.scrollIntoView() method (like the com.codeborne.selenide.SelenideElement.scrollTo() method) and call this code:

((JavascriptExecutor) item.getWrappedDriver()).executeScript("arguments[0].scrollIntoView(true);", item.getWrappedElement()); //$NON-NLS-1$

We need this to provide a workaround for mozilla/geckodriver#776 & mozilla/geckodriver#1039

Details

Detail please see above

Tell us about your environment

  • Selenide Version: 4.8
  • Firefox Version: 57.0.2
  • Browser Driver Version: v0.19.1
  • Selenium Version: 3.8.1
  • OS Version: Windows 10 1709

Code To Reproduce Issue [ Good To Have ]

It's just not possible to click to a button outside the scroll pane with firefox due to the bugs i've linked above. To wrap that inside selenide, it would be cool to provide this feature

@mseele

This comment has been minimized.

Show comment
Hide comment
@mseele

mseele Dec 22, 2017

Contributor

Found a workaround for my problem:

// workaround for https://github.com/mozilla/geckodriver/issues/776
Commands.getInstance().add("click", new Click() { //$NON-NLS-1$
	@Override
	protected void click(WebElement element) {
		if (WebDriverRunner.isMarionette()) {
			executeJavaScript("arguments[0].scrollIntoView(true);", element); //$NON-NLS-1$
		}
		super.click(element);
	}
});

This is awesome, did not know until now that i can "override" SelenideElement actions. Insane.

Contributor

mseele commented Dec 22, 2017

Found a workaround for my problem:

// workaround for https://github.com/mozilla/geckodriver/issues/776
Commands.getInstance().add("click", new Click() { //$NON-NLS-1$
	@Override
	protected void click(WebElement element) {
		if (WebDriverRunner.isMarionette()) {
			executeJavaScript("arguments[0].scrollIntoView(true);", element); //$NON-NLS-1$
		}
		super.click(element);
	}
});

This is awesome, did not know until now that i can "override" SelenideElement actions. Insane.

@rosolko rosolko referenced this issue Dec 28, 2017

Merged

Add command to scroll into view related to #649 #656

3 of 3 tasks complete

BorisOsipov added a commit that referenced this issue Jan 10, 2018

Merge pull request #656 from rosolko/scroll_into_view
Add command to scroll into view related to #649

@asolntsev asolntsev self-assigned this Jan 13, 2018

@asolntsev asolntsev added this to the 4.10 milestone Jan 13, 2018

@asolntsev

This comment has been minimized.

Show comment
Hide comment
@asolntsev

asolntsev Jan 13, 2018

Contributor

@mseele Implemented in Selenide 4.10

Contributor

asolntsev commented Jan 13, 2018

@mseele Implemented in Selenide 4.10

@asolntsev asolntsev closed this Jan 13, 2018

@yvasylenko

This comment has been minimized.

Show comment
Hide comment
@yvasylenko

yvasylenko Feb 8, 2018

Hi, @asolntsev I'm interested in this fix for Windows 10 and Microsoft Edge 41, but after I upgraded to 4.10.01 I've got org.openqa.selenium.WebDriverException: Unable to parse remote response: Unknown error on test start.

yvasylenko commented Feb 8, 2018

Hi, @asolntsev I'm interested in this fix for Windows 10 and Microsoft Edge 41, but after I upgraded to 4.10.01 I've got org.openqa.selenium.WebDriverException: Unable to parse remote response: Unknown error on test start.

@BorisOsipov

This comment has been minimized.

Show comment
Hide comment
@BorisOsipov

BorisOsipov Feb 8, 2018

Member

@yvasylenko please create sepparate issue with code example. We are not a psychics to help without any code.

Member

BorisOsipov commented Feb 8, 2018

@yvasylenko please create sepparate issue with code example. We are not a psychics to help without any code.

@yvasylenko

This comment has been minimized.

Show comment
Hide comment
@yvasylenko

yvasylenko Feb 9, 2018

@BorisOsipov I reproduced this issue on a simple case yesterday's evening (just open any page). But today everything works fine, without any changes. So there is no issue anymore.

P.S. How/Where can I contact you regarding possible workaround for safaridriver issue? Should I create another issue here?

yvasylenko commented Feb 9, 2018

@BorisOsipov I reproduced this issue on a simple case yesterday's evening (just open any page). But today everything works fine, without any changes. So there is no issue anymore.

P.S. How/Where can I contact you regarding possible workaround for safaridriver issue? Should I create another issue here?

@BorisOsipov

This comment has been minimized.

Show comment
Hide comment
@BorisOsipov
Member

BorisOsipov commented Feb 9, 2018

@yvasylenko

This comment has been minimized.

Show comment
Hide comment
@yvasylenko

yvasylenko Feb 9, 2018

Ok, thanks for your attention, I'll write there.

yvasylenko commented Feb 9, 2018

Ok, thanks for your attention, I'll write there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment