[arquillian-issues] [JBoss JIRA] (ARQGRA-417) Support for automatic scrolling to element before its usage

Jiří Štefek (JIRA) issues at jboss.org
Mon Feb 8 07:26:00 EST 2016


    [ https://issues.jboss.org/browse/ARQGRA-417?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13159686#comment-13159686 ] 

Jiří Štefek commented on ARQGRA-417:
------------------------------------

Imho the {{window.scrollTo(x,y)}} function cannot handle elements inside scrollable areas/elements (e.g. div#innerMiddle in https://gist.github.com/jstefek/3bfccc622dfe7c93fe3b). The better choice should be {{element.scrollIntoView()}} ([link|https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView]).

So the code would look like:
{code:java}
jsExecutor.executeScript("arguments[0].scrollIntoView();",element);
{code}


> Support for automatic scrolling to element before its usage
> -----------------------------------------------------------
>
>                 Key: ARQGRA-417
>                 URL: https://issues.jboss.org/browse/ARQGRA-417
>             Project: Arquillian Graphene
>          Issue Type: Feature Request
>          Components: core
>    Affects Versions: 2.0.1.Final
>            Reporter: Juraj Húska
>            Priority: Minor
>             Fix For: 2.2-Tracking
>
>
> It would be nice if Graphene supports automatic scrolling of browser window to {{WebElement}} / Page Fragment before its is used.
> It can be useful for interactions with various popups web components: contextMenu, tooltip, ...
> Those components can not be interacted correctly when they are not in the viewport, and thus one needs to scroll to them manually in his test.
> It is often problem in CI environment, where tests run on screens with lower resolution (smaller part of the page fit the browser window, and lot of elements are not in the viewport).
> My naive implementation of this would look like:
> * intercept all calls to {{WebElements}} and PageFragments root elements
> * in the interceptor method get the location of the element by: {{Point location = element.getLocation();}}
> * a then scroll to it: {{jsExecutor.executeScript("window.scrollTo("" + location.getX() +", " + location.getY() + ")");}}



--
This message was sent by Atlassian JIRA
(v6.4.11#64026)



More information about the arquillian-issues mailing list