2gis / Winium.Desktop

Winium.Desktop is Selenium Remote WebDriver implementation for automated testing of Windows application based on WinFroms and WPF platforms.
Mozilla Public License 2.0
402 stars 140 forks source link

Unable to get co-ordinates of selected object #334

Open Deepika2792 opened 4 years ago

Deepika2792 commented 4 years ago

I am trying to get the co-ordinates of a selected object.

My code is as follows: WebElement obj=driver.switchTo().activeElement(); Point p=obj.getLocation(); int x=p.getX(); int y=p.getY(); Log.info("X co-pordinate is:"+x+" Y co=ordinate is:"+y);

I have used driver.switchTo().activeElement() because UIspy is not recognizing the object.

This code is giving me null pointer as follows: org.openqa.selenium.UnsupportedCommandException: 'getElementLocation' is not valid or implemented command. (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 16 milliseconds Build info: version: '2.48.2', revision: '41bccdd10cf2c0560f637404c2d96164b67d9d67', time: '2015-10-09 13:08:06' System info: host: 'xyz', ip: '10.65.166.243', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_161' Driver info: org.openqa.selenium.winium.WiniumDriver Capabilities [{app=C:\Informatica1041\10.4.1\clients\PowerCenterClient\client\bin\pmwflmgr.exe, args=, innerPort=9998, debugConnectToRunningApp=false, keyboardSimulator=1, launchDelay=0, platform=ANY}] Session ID: AwesomeSession

Can anyone please let me know how we can get the co-ordinates of selected object?

Deepika2792 commented 4 years ago

@skyline-gleb , @NickAb
Can you help me on the above mentioned issue?

yatendra99 commented 3 years ago

@Deepika2792 Try: webelement.getAttribute("BoundingRectangle");

It will return you coordinates