简体   繁体   English

如何在C#中获取Selenium的IWebElement位置?

[英]How to get Selenium's IWebElement position in C#?

I've tried to find a way how to get the IWebElement's position (images in particular) and use it in my C# tests. 我试图找到一种方法来获取IWebElement的位置(尤其是图像)并在我的C#测试中使用它。 So far the only example I was able to dig in is in Python. 到目前为止,我能够挖掘的唯一示例是Python。 Is there such org.openqa.selenium.Dimension equivalence for C# ? C#是否具有org.openqa.selenium.Dimension等效项?

您可以尝试以下JS代码:

$('#<element id>').position().top.toString() + ',' + $('#<element id>').position().left.toString()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM