स्थान प्राप्त करें
पृष्ठ पर एक तत्व का स्थान निर्धारित करें। बिंदु (0, 0) पृष्ठ के ऊपरी-बायें कोने को संदर्भित करता है।
उपयोग
$(selector).getLocation(prop)
पैरामीटर्स
नाम | प्रकार | विवरण |
---|---|---|
prop | string | आसान परिणाम के लिए "x" या "y" हो सकता है जिससे सीधे मूल्य प्राप्त हो |
उदाहरण
getLocation.js
it('should demonstrate the getLocation function', async () => {
await browser.url('http://github.com');
const logo = await $('.octicon-mark-github')
const location = await logo.getLocation();
console.log(location); // outputs: { x: 150, y: 20 }
const xLocation = await logo.getLocation('x')
console.log(xLocation); // outputs: 150
const yLocation = await logo.getLocation('y')
console.log(yLocation); // outputs: 20
});
रिटर्न्स
- <Object|Number>
return
: पृष्ठ पर तत्व के लिए X और Y निर्देशांक{x:number, y:number}