Using “storeElementPositionLeft” and “storeElementPositionTop” Commands in selenium

“storeElementPositionLeft” Command

In selenium, Many times you need  horizontal and verticle position of element on page. When you need any element’s horizontal position on the page, you can use “storeElementPositionLeft” Command. It will return and store element’s horizontal position in to specified veriable in value column.
In Bellow given example, storeElementPositionLeft command will store google search box’s horizontal position in to variable “left”.

New Test
Command Target Value
open www.google.com
storeElementPositionLeft gs_htif0 left
echo ${left}
storeElementPositionTop gs_htif0 top
echo ${top}

“storeElementPositionTop” Command
“storeElementPositionTop” Command is useful to store vertical position of an element in to variable. In above wxample, storeElementPositionTop command will store google search box’s vertical position in to variable “top”.

Leave a Reply

Your email address will not be published. Required fields are marked *