how to scroll a locator using robot framework - robotframework

I'm using angular in my frontend, in some part of my page I included virtual scrolling:
https://material.angular.io/cdk/scrolling/overview
For those who don't know, it's used to avoid render all the data at once in huge lists, what it does is it include in the frontend only those items that are shown depending on scroll bar.
Now I want to check that all the items are in this virtual table, so, what i need is scroll down until the item locator apears.
I was thinking in something like scroll down about 50 px and check if item is there, if it is, then stop, else continue scrolling.
The problem is I can't find how to scroll using robot framework, I only see:
Scroll Element Into View ${locator}
But it's not useful for me because my item is not "hidden" it doesnt exist.
is it a way to do something like:
Scroll down my item 50px ${locator}
And
Scroll my item to top ${locator}

And what about if element does not have an id?
I made this kEYWORD but is a little intrusive with DOM
Scroll to xpath
[Arguments] ${xpath}
${tmp}= SeleniumLibrary.get element attribute ${xpath} id
assign id to element ${xpath} scrollID
execute javascript document.getElementById('scrollID').scrollIntoView();
run keyword if '${tmp}' != '${EMPTY}' assign id to element ${xpath} ${tmp}
Any suggestions will be appreciated

you can use the below keyword
Source: AppiumLibrary [Documentation]
Arguments: [start_locator, end_locator]
Scrolls from one element to another, Key attributes for arbitrary elements are id and name.
Syntax:
Scroll start_locator end_locator
in order to use the scroll keyword you would need to have the Appium library
Note: both the elements should be visible for the scroll action, the swipe action will be performed with the start element to the end element.
Documentation: https://serhatbolsu.github.io/robotframework-appiumlibrary/AppiumLibrary.html#Scroll

Related

Why do I get a different offsetHeight value within ngOnChanges?

Example plunker:
http://plnkr.co/edit/YLLslImGOpS8u6zx
In the plunker, I display the height and width of a div from the parent component using ViewChild.
I pass the div from the parent component to the child component as an Input HTMLElement, and in the child component, I again read the currentValue of this input. If you open the browser console, I logged the SimpleChanges object. If you look at the currentValue.offsetHeight, the height is the expected value (i.e. the value matches what the parent component is displaying)
However, the child component is displaying a different value from the expected.
Whats even stranger is if you edit the child component template to something like:
<div>
<p>Child: {{ display }}</p>
</div>
Simply adding some additional content in the div, the child component now displays the expected value (i.e. the value matches what the parent component is displaying, and it matches the value in SimpleChanges)
To put it simply, why does this difference occur?
In my code-base, I'm experiencing an issue using offsetHeight where the value within SimpleChanges is accurate, but the value I try to store on an instance variable and use within the component is inaccurate. This plunker probably does not emulate exactly the issue I face in my code-base but maybe understanding the cause/effects of what I described above might help me figure out the problem I face in my code-base.
Thanks!

how to vertically scroll to an element in robot framework, with selenium2library

please let me know how to vertically scroll to a particular element in robot framework with selenium2library.
I have dynamically changing values , that i am appending in the xpath and want to scroll to that element.
below is the syntax that i have tried.
Execute Javascript window.document.getElementByXpath('//div[#data-documenttype= "${name}"]).scrollIntoView(true);
***Settings***
Library ExtendedSelenium2Library
*** Keywords ****
**Scroll Right Panel To Click a File**
Scroll Element Into View ${Element-path-From}
Wait Until Element is visible ${Element-Path-To} timeout=5s
Set Focus To Element ${Element-Path-To}
Click Element ${Element-Path-To}
I didn't have to setup the extra library. This works for me:
Execute JavaScript window.scrollTo(0, document.body.scrollHeight)

Drop scroll using select in last line of the table

I made a custom dropdown. In the last line of the table, scroll is created when dropdown is open. I need to scroll to see dropdown elements. I do not want this.
I want you to open up the body of the dropdown or enlarge the body. How can I do it?
Document is already enlarged by enlarged content/element, scroll shows that. You need only scroll to view entire enlarged element, f.e.:
elmnt.scrollIntoView(false);
Real problem (using react) is that should be done after change state and rendering enlarged element.
I probably would use setTimeout called from setState callback. It's quite common way to be sure it's called after updating state/view. You'll find examples on SO.

Handle scrollbar in selemium2

How I can get scrollbar within div element using selenium webdriver and firefox browser?
I need to validate case: scroll bar will appear when table (table located inside div) has more then 10 rows.
I think if developed is publishing the scroll bar properties in HTML properties, then you will be able to capture, else you will have to discuss with developers.
After that you can get the row count using webdriver method
driver.findElements(By.xpath("XPATH expression")).size();
and using a if condition You can validate the scroll bar.
Thanks

On mouse over surround element with additional elements without moving it

i need some pointers here because i don't really know what to look for.
The project is in gwt and is using gwtquery.
I have this page with some elements and when the mouse overs an element it changes showing additional infos, let's call it header. When the mouse goes out of the header (which has some buttons so it need to stay visible once shown) it returns invisible.
The problem is that when the header is made visible all the elements of the page change position because my element changes in dimension. What i wish to do is to keep the element in the same position and overlap the header over everything with z-index.
It's not about GWT at first hand. It's mostly about general concepts of elements positioning and layout building for html pages. You should start from something like http://www.w3schools.com/Css/css_positioning.asp
And then find the appropriate tools in GWT framework or in third party libraries that are available.

Resources