Best Selenium code snippet using org.openqa.selenium.remote.RemoteWebElement.getLocation
Source:pureElement.java  
...136		this.centerOnScreen(); // Method to put object in center of the screen if partially or not visible137		this.pureElementMethodCall( "clear" );138	}139	// ************************************************************************************************************************ clear140	// WebElement              [1]  = public abstract org.openqa.selenium.Point org.openqa.selenium.WebElement.getLocation()141	// AndroidElement          [32] = public org.openqa.selenium.Point org.openqa.selenium.remote.RemoteWebElement.getLocation()142	// IOSElement              [31] = public org.openqa.selenium.Point org.openqa.selenium.remote.RemoteWebElement.getLocation()143	// MobileElement           [31] = public org.openqa.selenium.Point org.openqa.selenium.remote.RemoteWebElement.getLocation()144	public org.openqa.selenium.Point getLocation(){145		this.refresh();        // Method to detect, update and centre the object on screen if existing.146		return ( org.openqa.selenium.Point )this.pureElementMethodCall( "getLocation" );147	}148	// ************************************************************************************************************************ clear149	// WebElement              [2]  = public abstract org.openqa.selenium.Dimension org.openqa.selenium.WebElement.getSize()150	// AndroidElement          [34] = public org.openqa.selenium.Dimension org.openqa.selenium.remote.RemoteWebElement.getSize()151	// IOSElement              [33] = public org.openqa.selenium.Dimension org.openqa.selenium.remote.RemoteWebElement.getSize()152	// MobileElement           [33] = public org.openqa.selenium.Dimension org.openqa.selenium.remote.RemoteWebElement.getSize()153	public org.openqa.selenium.Dimension getSize(){154		this.refresh();        // Method to detect, update and centre the object on screen if existing.155		return ( org.openqa.selenium.Dimension )this.pureElementMethodCall( "getSize" );156	}157	// ************************************************************************************************************************ clear158	// WebElement              [3]  = public abstract org.openqa.selenium.WebElement org.openqa.selenium.WebElement.findElement(org.openqa.selenium.By)159	// AndroidElement          [2]  = public org.openqa.selenium.WebElement io.appium.java_client.android.AndroidElement.findElement(org.openqa.selenium.By)160	// IOSElement              [3]  = public org.openqa.selenium.WebElement io.appium.java_client.ios.IOSElement.findElement(org.openqa.selenium.By)161	// MobileElement           [5]  = public java.util.List io.appium.java_client.MobileElement.findElements(org.openqa.selenium.By)162	public pureElement findElement( Object by ){163		this.refresh();        // Method to detect, update and centre the object on screen if existing.164		Object SourceObject = this.pureElementMethodCall( "findElement", by );165		if ( SourceObject != null ) {166			pureCore.peMethod myMethod = pureCore.peMethodFromBy( by.toString() );167			pureElement newPureElement = new pureElement( "The Name", "The Type", myMethod.peMethodid, myMethod.peSearch, pureCore.defRefreshMode, this );168			newPureElement.theElement = SourceObject;169			newPureElement.refrehCode = "0xFFFFFFFF";170			return newPureElement;171		}else {172			return null;173		}	174	}175	// ************************************************************************************************************************ clear176	// WebElement              [4]  = public abstract java.util.List org.openqa.selenium.WebElement.findElements(org.openqa.selenium.By)177	// AndroidElement          [16] = public java.util.List io.appium.java_client.MobileElement.findElements(org.openqa.selenium.By)178	// IOSElement              [15] = public java.util.List io.appium.java_client.MobileElement.findElements(org.openqa.selenium.By)179	// MobileElement           [4]  = public org.openqa.selenium.WebElement io.appium.java_client.MobileElement.findElement(org.openqa.selenium.By)180	public pureElements findElements( Object by ){181		this.refresh();        // Method to detect, update and centre the object on screen if existing.182		Object feedback = this.pureElementMethodCall( "findElements", by );183		List<Object> myObjectList = pureCore.CastObjecttoList( feedback	);184		if ( myObjectList != null ) {185			pureCore.peMethod myMethod = pureCore.peMethodFromBy( by.toString() );186			pureElements newPureElements = new pureElements( "-", "-", myMethod.peMethodid, myMethod.peSearch, pureCore.defRefreshMode, this );187			newPureElements.theElements = myObjectList;188			newPureElements.refrehCode = "0xFFFFFFFF";189			return newPureElements;190		}else {191			return null;192		}193	}194	195	// ************************************************************************************************************************ clear196	// WebElement              [5]  = public abstract void org.openqa.selenium.WebElement.click()197	// AndroidElement          [38] = public void org.openqa.selenium.remote.RemoteWebElement.click()198	// IOSElement              [37] = public void org.openqa.selenium.remote.RemoteWebElement.click()199	// MobileElement           [37] = public void org.openqa.selenium.remote.RemoteWebElement.click()200	public void click() {201		this.refresh();        // Method to detect, update and centre the object on screen if existing.202		// this.centerOnScreen(); // Method to put object in center of the screen if partially or not visible203		this.pureElementMethodCall( "click" );204	}205	206	// ************************************************************************************************************************ clear207	// WebElement              [6]  = public abstract void org.openqa.selenium.WebElement.sendKeys(java.lang.CharSequence[])208	// AndroidElement          [39] = public void org.openqa.selenium.remote.RemoteWebElement.sendKeys(java.lang.CharSequence[])209	// IOSElement              [38] = public void org.openqa.selenium.remote.RemoteWebElement.sendKeys(java.lang.CharSequence[])210	// MobileElement           [38] = public void org.openqa.selenium.remote.RemoteWebElement.sendKeys(java.lang.CharSequence[])211	public void sendKeys( String charSequence ) {212		this.refresh();        // Method to detect, update and centre the object on screen if existing.213		this.centerOnScreen(); // Method to put object in center of the screen if partially or not visible214		pureDriverDetails myDriver = pureDrivers.getCurrentDriverDetails();215		java.lang.CharSequence mySequency[] = new java.lang.CharSequence[ charSequence.length() ];216		for( int iLoop = 0; iLoop < charSequence.length(); iLoop++ ) {217			mySequency[ iLoop ] = charSequence.substring( iLoop, iLoop +1 );218		}219		pureCore.callMethod( this.theElement, myDriver.elementClass, "sendKeys", java.lang.CharSequence[].class, "pureElement.sendKeys", mySequency );220	}221	// ************************************************************************************************************************ clear222	// WebElement              [7]  = public abstract void org.openqa.selenium.WebElement.submit()223	// AndroidElement          [12] = public void io.appium.java_client.android.AndroidElement.submit() throws org.openqa.selenium.WebDriverException224	// IOSElement              [12] = public void io.appium.java_client.ios.IOSElement.submit() throws org.openqa.selenium.WebDriverException225	// MobileElement           [23] = public void io.appium.java_client.MobileElement.submit() throws org.openqa.selenium.WebDriverException226	public void submit() {227		this.refresh();        // Method to detect, update and centre the object on screen if existing.228		this.centerOnScreen(); // Method to put object in center of the screen if partially or not visible229		this.pureElementMethodCall( "submit" );230	}231	232	// ************************************************************************************************************************ clear233	// WebElement              [8]  = public abstract java.lang.String org.openqa.selenium.WebElement.getTagName()234	// AndroidElement          [40] = public java.lang.String org.openqa.selenium.remote.RemoteWebElement.getTagName()235	// IOSElement              [39] = public java.lang.String org.openqa.selenium.remote.RemoteWebElement.getTagName()236	// MobileElement           [39] = public java.lang.String org.openqa.selenium.remote.RemoteWebElement.getTagName()237	public String getTagName() {238		this.refresh();        // Method to detect, update and centre the object on screen if existing.239		return (String)this.pureElementMethodCall( "getTagName" );240	}241	242	// ************************************************************************************************************************ clear243	// WebElement              [9]  = public abstract java.lang.String org.openqa.selenium.WebElement.getAttribute(java.lang.String)244	// AndroidElement          [41] = public java.lang.String org.openqa.selenium.remote.RemoteWebElement.getAttribute(java.lang.String)245	// IOSElement              [40] = public java.lang.String org.openqa.selenium.remote.RemoteWebElement.getAttribute(java.lang.String)246	// MobileElement           [40] = public java.lang.String org.openqa.selenium.remote.RemoteWebElement.getAttribute(java.lang.String)247	public String getAttribute( String AttributeName ) {248		this.refresh();        // Method to detect, update and centre the object on screen if existing.249		return (String)this.pureElementMethodCall( "getAttribute", (Object)AttributeName );250	}251	252	// ************************************************************************************************************************ clear253	// WebElement              [10] = public abstract boolean org.openqa.selenium.WebElement.isSelected()254	// AndroidElement          [42] = public boolean org.openqa.selenium.remote.RemoteWebElement.isSelected()255	// IOSElement              [41] = public boolean org.openqa.selenium.remote.RemoteWebElement.isSelected()256	// MobileElement           [41] = public boolean org.openqa.selenium.remote.RemoteWebElement.isSelected()257	public boolean isSelected() {258		this.refresh();259		return (boolean)this.pureElementMethodCall( "isSelected" );260	}261	262	// ************************************************************************************************************************ clear263	// WebElement              [11] = public abstract boolean org.openqa.selenium.WebElement.isEnabled()264	// AndroidElement          [43] = public boolean org.openqa.selenium.remote.RemoteWebElement.isEnabled()265	// IOSElement              [42] = public boolean org.openqa.selenium.remote.RemoteWebElement.isEnabled()266	// MobileElement           [42] = public boolean org.openqa.selenium.remote.RemoteWebElement.isEnabled()267	public boolean isEnabled() {268		this.refresh();269		return (boolean)this.pureElementMethodCall( "isEnabled" );270	}271	272	// ************************************************************************************************************************ clear273	// WebElement              [12] = public abstract java.lang.String org.openqa.selenium.WebElement.getText()274	// AndroidElement          [44] = public java.lang.String org.openqa.selenium.remote.RemoteWebElement.getText()275	// IOSElement              [43] = public java.lang.String org.openqa.selenium.remote.RemoteWebElement.getText()276	// MobileElement           [43] = public java.lang.String org.openqa.selenium.remote.RemoteWebElement.getText()277	public String getText() {278		this.refresh();279		return (String)this.pureElementMethodCall( "getText" );280	}281	282	// ************************************************************************************************************************ clear283	// WebElement              [13] = public abstract boolean org.openqa.selenium.WebElement.isDisplayed()284	// AndroidElement          [45] = public boolean org.openqa.selenium.remote.RemoteWebElement.isDisplayed()285	// IOSElement              [44] = public boolean org.openqa.selenium.remote.RemoteWebElement.isDisplayed()286	// MobileElement           [44] = public boolean org.openqa.selenium.remote.RemoteWebElement.isDisplayed()287	public boolean isDisplayed() {288		this.refresh();289		return (boolean)this.pureElementMethodCall( "isDisplayed" );290	}291	// ************************************************************************************************************************ clear292	// WebElement              [14] = public abstract org.openqa.selenium.Rectangle org.openqa.selenium.WebElement.getRect()293	// AndroidElement          [46] = public org.openqa.selenium.Rectangle org.openqa.selenium.remote.RemoteWebElement.getRect()294	// IOSElement              [45] = public org.openqa.selenium.Rectangle org.openqa.selenium.remote.RemoteWebElement.getRect()295	// MobileElement           [45] = public org.openqa.selenium.Rectangle org.openqa.selenium.remote.RemoteWebElement.getRect()296	public org.openqa.selenium.Rectangle getRect() {297		this.refresh();298		return (org.openqa.selenium.Rectangle)this.pureElementMethodCall( "getRect" );299	}300	// ************************************************************************************************************************ clear301	// WebElement              [15] = public abstract java.lang.String org.openqa.selenium.WebElement.getCssValue(java.lang.String)302	// AndroidElement          [13] = public java.lang.String io.appium.java_client.android.AndroidElement.getCssValue(java.lang.String) throws org.openqa.selenium.WebDriverException303	// IOSElement              [13] = public java.lang.String io.appium.java_client.ios.IOSElement.getCssValue(java.lang.String) throws org.openqa.selenium.WebDriverException304	// MobileElement           [24] = public java.lang.String io.appium.java_client.MobileElement.getCssValue(java.lang.String) throws org.openqa.selenium.WebDriverException305	public String getCssValue( String cssValue ) {306		this.refresh();307		return (String)this.pureElementMethodCall( "getCssValue", (Object) cssValue );308	}309	// ************************************************************************************************************************ clear310	// WebElement              [16] = public abstract java.lang.Object org.openqa.selenium.TakesScreenshot.getScreenshotAs(org.openqa.selenium.OutputType) throws org.openqa.selenium.WebDriverException311	// AndroidElement          [37] = public java.lang.Object org.openqa.selenium.remote.RemoteWebElement.getScreenshotAs(org.openqa.selenium.OutputType) throws org.openqa.selenium.WebDriverException312	// IOSElement              [36] = public java.lang.Object org.openqa.selenium.remote.RemoteWebElement.getScreenshotAs(org.openqa.selenium.OutputType) throws org.openqa.selenium.WebDriverException313	// MobileElement           [36] = public java.lang.Object org.openqa.selenium.remote.RemoteWebElement.getScreenshotAs(org.openqa.selenium.OutputType) throws org.openqa.selenium.WebDriverException314	public Object getScreenshotAs( org.openqa.selenium.OutputType<?> outputType ) {315		this.refresh();316		this.centerOnScreen(); // Method to put object in center of the screen if partially or not visible317		return this.pureElementMethodCall( "getScreenshotAs", (Object) outputType );318	}319	// ************************************************************************************************************************ 320	// AndroidElement          [0]  = public org.openqa.selenium.remote.Response io.appium.java_client.android.AndroidElement.execute(java.lang.String,java.util.Map)321	// IOSElement              [0]  = public org.openqa.selenium.remote.Response io.appium.java_client.ios.IOSElement.execute(java.lang.String,java.util.Map)322	// MobileElement           [1] = public org.openqa.selenium.remote.Response io.appium.java_client.MobileElement.execute(java.lang.String,java.util.Map)323	public org.openqa.selenium.remote.Response execute( java.lang.String execute, java.util.Map<?,?> map ){324		this.refresh();325		this.centerOnScreen(); // Method to put object in center of the screen if partially or not visible326		pureDriverDetails myDriver = pureDrivers.getCurrentDriverDetails();327		//328		Class<?>[] myClasses = new Class[2];329		myClasses[ 0 ] = java.lang.String.class;330		myClasses[ 1 ] = java.util.Map.class;331		//332		Object[] myTrueParam = new Object[2];333		myTrueParam[ 0 ] = (Object)execute;334		myTrueParam[ 1 ] = (Object)map;335		//336		return (org.openqa.selenium.remote.Response)pureCore.callMethod(337				this.theElement, myDriver.elementClass, "execute", myClasses, "pureElement.execute", myTrueParam );338	}339	// ************************************************************************************************************************ 340	// AndroidElement          [1]  = public org.openqa.selenium.remote.Response io.appium.java_client.android.AndroidElement.execute(java.lang.String)341	// IOSElement              [1]  = public org.openqa.selenium.remote.Response io.appium.java_client.ios.IOSElement.execute(java.lang.String)342	// MobileElement           [0]  = public org.openqa.selenium.remote.Response io.appium.java_client.MobileElement.execute(java.lang.String)343	public org.openqa.selenium.remote.Response execute( java.lang.String execute ){344		this.refresh();345		this.centerOnScreen(); // Method to put object in center of the screen if partially or not visible346		pureDriverDetails myDriver = pureDrivers.getCurrentDriverDetails();347		return (org.openqa.selenium.remote.Response)pureCore.callMethod(348				this.theElement, myDriver.elementClass, "execute", java.lang.String.class, "pureElement.execute", execute );349	}350	351	// ************************************************************************************************************************ 352	// AndroidElement          [3]  = public org.openqa.selenium.WebElement io.appium.java_client.android.AndroidElement.findElement(java.lang.String,java.lang.String)353	// IOSElement              [2]  = public org.openqa.selenium.WebElement io.appium.java_client.ios.IOSElement.findElement(java.lang.String,java.lang.String)354	// MobileElement           [3]  = public org.openqa.selenium.WebElement io.appium.java_client.MobileElement.findElement(java.lang.String,java.lang.String)355	public pureElement findElement( String method, String path ){356		this.refresh();        // Method to detect, update and centre the object on screen if existing.357		pureDriverDetails myDriver = pureDrivers.getCurrentDriverDetails();358		//359		Class<?>[] myClasses = new Class[2];360		myClasses[ 0 ] = java.lang.String.class;361		myClasses[ 1 ] = java.lang.String.class;362		//363		Object[] myTrueParam = new Object[2];364		myTrueParam[ 0 ] = (Object)method;365		myTrueParam[ 1 ] = (Object)path;366		//367		Object SourceObject = (Object)pureCore.callMethod( this.theElement, myDriver.elementClass, "findElement", myClasses, "pureElement.findElement", myTrueParam );368		if ( SourceObject != null ) {369			int elemMethod = pureCore.MethodFromStringLocator( method );370			pureElement newPureElement = new pureElement( "The Name", "The Type", elemMethod, path, pureCore.defRefreshMode, this );371			newPureElement.theElement = SourceObject;372			newPureElement.refrehCode = "0xFFFFFFFF";373			return newPureElement;374		}else {375			return null;376		}	377	}378	379	// ************************************************************************************************************************ 380	// Internal optimisation for following findElement methods.381	private pureElement intFindElementXXX( String MethodName, int elementMethod, String Description ) {382		this.refresh();383		Object SourceObject = (Object) this.pureElementMethodCall( MethodName, (Object)Description );384		if ( SourceObject != null ) {385			pureElement newPureElement = new pureElement( "The Name", "The Type", elementMethod, Description, pureCore.defRefreshMode, this );386			newPureElement.theElement = SourceObject;387			newPureElement.refrehCode = "0xFFFFFFFF";388			return newPureElement;389		}else {390			return (pureElement)null;391		}		392	}	393	394	// ************************************************************************************************************************ 395	// AndroidElement          [4]  = public org.openqa.selenium.WebElement io.appium.java_client.android.AndroidElement.findElementByLinkText(java.lang.String) throws org.openqa.selenium.WebDriverException396	// IOSElement              [4]  = public org.openqa.selenium.WebElement io.appium.java_client.ios.IOSElement.findElementByLinkText(java.lang.String) throws org.openqa.selenium.WebDriverException397	// MobileElement           [7]  = public org.openqa.selenium.WebElement io.appium.java_client.MobileElement.findElementByLinkText(java.lang.String) throws org.openqa.selenium.WebDriverException398	public pureElement findElementByLinkText( String Description ){399		return this.intFindElementXXX( "findElementByLinkText", pureCore.elementMethod.linkText, Description );400	}401	// ************************************************************************************************************************ 402	// AndroidElement          [5]  = public org.openqa.selenium.WebElement io.appium.java_client.android.AndroidElement.findElementByPartialLinkText(java.lang.String) throws org.openqa.selenium.WebDriverException403	// IOSElement              [5]  = public org.openqa.selenium.WebElement io.appium.java_client.ios.IOSElement.findElementByPartialLinkText(java.lang.String) throws org.openqa.selenium.WebDriverException404	// MobileElement           [8]  = public org.openqa.selenium.WebElement io.appium.java_client.MobileElement.findElementByPartialLinkText(java.lang.String) throws org.openqa.selenium.WebDriverException405	public pureElement findElementByPartialLinkText( String Description ){406		return this.intFindElementXXX( "findElementByPartialLinkText", pureCore.elementMethod.partialLinkText, Description );407	}408	409	// ************************************************************************************************************************ 410	// AndroidElement          [6]  = public org.openqa.selenium.WebElement io.appium.java_client.android.AndroidElement.findElementByTagName(java.lang.String)411	// IOSElement              [6]  = public org.openqa.selenium.WebElement io.appium.java_client.ios.IOSElement.findElementByTagName(java.lang.String)412	// MobileElement           [9]  = public org.openqa.selenium.WebElement io.appium.java_client.MobileElement.findElementByTagName(java.lang.String)413	public pureElement findElementByTagName( String Description ){414		return this.intFindElementXXX( "findElementByTagName", pureCore.elementMethod.tagNamei, Description );415	}416	417	// ************************************************************************************************************************ 418	// AndroidElement          [7]  = public org.openqa.selenium.WebElement io.appium.java_client.android.AndroidElement.findElementByName(java.lang.String)419	// IOSElement              [7]  = public org.openqa.selenium.WebElement io.appium.java_client.ios.IOSElement.findElementByName(java.lang.String)420	// MobileElement           [10] = public org.openqa.selenium.WebElement io.appium.java_client.MobileElement.findElementByName(java.lang.String)421	public pureElement findElementByName( String Description ){422		return this.intFindElementXXX( "findElementByName", pureCore.elementMethod.name, Description );423	}424	425	// ************************************************************************************************************************ 426	// AndroidElement          [8]  = public org.openqa.selenium.WebElement io.appium.java_client.android.AndroidElement.findElementByClassName(java.lang.String)427	// IOSElement              [8]  = public org.openqa.selenium.WebElement io.appium.java_client.ios.IOSElement.findElementByClassName(java.lang.String)428	// MobileElement           [11] = public org.openqa.selenium.WebElement io.appium.java_client.MobileElement.findElementByClassName(java.lang.String)429	public pureElement findElementByClassName( String Description ){430		return this.intFindElementXXX( "findElementByClassName", pureCore.elementMethod.className, Description );431	}432	433	// ************************************************************************************************************************ 434	// AndroidElement          [9]  = public org.openqa.selenium.WebElement io.appium.java_client.android.AndroidElement.findElementByCssSelector(java.lang.String) throws org.openqa.selenium.WebDriverException435	// IOSElement              [9]  = public org.openqa.selenium.WebElement io.appium.java_client.ios.IOSElement.findElementByCssSelector(java.lang.String) throws org.openqa.selenium.WebDriverException436	// MobileElement           [12] = public org.openqa.selenium.WebElement io.appium.java_client.MobileElement.findElementByCssSelector(java.lang.String) throws org.openqa.selenium.WebDriverException437	public pureElement findElementByCssSelector( String Description ){438		return this.intFindElementXXX( "findElementByCssSelector", pureCore.elementMethod.cssSelector, Description );439	}440	441	// ************************************************************************************************************************ 442	// AndroidElement          [10] = public org.openqa.selenium.WebElement io.appium.java_client.android.AndroidElement.findElementByXPath(java.lang.String)443	// IOSElement              [10] = public org.openqa.selenium.WebElement io.appium.java_client.ios.IOSElement.findElementByXPath(java.lang.String)444	// MobileElement           [13] = public org.openqa.selenium.WebElement io.appium.java_client.MobileElement.findElementByXPath(java.lang.String)445	public pureElement findElementByXPath( String Description ){446		return this.intFindElementXXX( "findElementByXPath", pureCore.elementMethod.xpath, Description );447	}448	449	// ************************************************************************************************************************ 450	// AndroidElement          [11] = public org.openqa.selenium.WebElement io.appium.java_client.android.AndroidElement.findElementById(java.lang.String)451	// IOSElement              [11] = public org.openqa.selenium.WebElement io.appium.java_client.ios.IOSElement.findElementById(java.lang.String)452	// MobileElement           [21] = public org.openqa.selenium.WebElement io.appium.java_client.MobileElement.findElementById(java.lang.String)453	public pureElement findElementById( String Description ){454		return this.intFindElementXXX( "findElementById", pureCore.elementMethod.id, Description );455	}456	457	// ************************************************************************************************************************ 458	// AndroidElement          [14] = public void io.appium.java_client.android.AndroidElement.replaceValue(java.lang.String)459	public void replaceValue( java.lang.String value ) {460		this.refresh();461		this.centerOnScreen(); // Method to put object in center of the screen if partially or not visible462		this.pureElementMethodCall( "replaceValue", (Object)value );463	}464	465	// ************************************************************************************************************************ 466	// AndroidElement          [15] = public void io.appium.java_client.MobileElement.setValue(java.lang.String)467	// IOSElement              [14] = public void io.appium.java_client.MobileElement.setValue(java.lang.String)468	// MobileElement           [2]  = public void io.appium.java_client.MobileElement.setValue(java.lang.String)469	public void setValue( java.lang.String value ) {470		this.refresh();471		this.centerOnScreen(); // Method to put object in center of the screen if partially or not visible472		this.pureElementMethodCall( "setValue", (Object)value );473	}474	// ************************************************************************************************************************ 475	// AndroidElement          [17] = public java.util.List io.appium.java_client.MobileElement.findElements(java.lang.String,java.lang.String)476	// IOSElement              [16] = public java.util.List io.appium.java_client.MobileElement.findElements(java.lang.String,java.lang.String)477	// MobileElement           [6]  = public java.util.List io.appium.java_client.MobileElement.findElements(java.lang.String,java.lang.String)478	479	// ************************************************************************************************************************ 480	// Internal optimisation for the following findElementsXXX methods481	private pureElements intFindElementsXXX( String MethodName, int elementMethod, String Description ) {482		this.refresh();        // Method to detect, update and centre the object on screen if existing.483		Object feedback = this.pureElementMethodCall( MethodName, (Object)Description );484		List<Object> myObjectList = pureCore.CastObjecttoList( feedback	);485		if ( myObjectList != null ) {486			pureElements newPureElements = new pureElements( "-", "-", elementMethod, Description, pureCore.defRefreshMode, this );487			newPureElements.theElements = myObjectList;488			newPureElements.refrehCode = "0xFFFFFFFF";489			return newPureElements;490		}else {491			return null;492		}493	}494	// ************************************************************************************************************************ 495	// AndroidElement          [18] = public java.util.List io.appium.java_client.MobileElement.findElementsByLinkText(java.lang.String)496	// IOSElement              [17] = public java.util.List io.appium.java_client.MobileElement.findElementsByLinkText(java.lang.String)497	// MobileElement           [14] = public java.util.List io.appium.java_client.MobileElement.findElementsByLinkText(java.lang.String)498	public pureElements findElementsByLinkText( java.lang.String Description ){499		return intFindElementsXXX( "findElementsByLinkText", pureCore.elementMethod.linkText, Description );500	}501	// ************************************************************************************************************************ 502	// AndroidElement          [19] = public java.util.List io.appium.java_client.MobileElement.findElementsByPartialLinkText(java.lang.String)503	// IOSElement              [18] = public java.util.List io.appium.java_client.MobileElement.findElementsByPartialLinkText(java.lang.String)504	// MobileElement           [15] = public java.util.List io.appium.java_client.MobileElement.findElementsByPartialLinkText(java.lang.String)505	public pureElements findElementsByPartialLinkText( java.lang.String Description ){506		return intFindElementsXXX( "findElementsByPartialLinkText", pureCore.elementMethod.partialLinkText, Description );507	}508	509	// ************************************************************************************************************************ 510	// AndroidElement          [20] = public java.util.List io.appium.java_client.MobileElement.findElementsByTagName(java.lang.String)511	// IOSElement              [19] = public java.util.List io.appium.java_client.MobileElement.findElementsByTagName(java.lang.String)512	// MobileElement           [16] = public java.util.List io.appium.java_client.MobileElement.findElementsByTagName(java.lang.String)513	public pureElements findElementsByTagName( java.lang.String Description ){514		return intFindElementsXXX( "findElementsByTagName", pureCore.elementMethod.tagNamei, Description );515	}516	517	// ************************************************************************************************************************ 518	// AndroidElement          [21] = public java.util.List io.appium.java_client.MobileElement.findElementsByName(java.lang.String)519	// IOSElement              [20] = public java.util.List io.appium.java_client.MobileElement.findElementsByName(java.lang.String)520	// MobileElement           [17] = public java.util.List io.appium.java_client.MobileElement.findElementsByName(java.lang.String)521	public pureElements findElementsByName( java.lang.String Description ){522		return intFindElementsXXX( "findElementsByName", pureCore.elementMethod.name, Description );523	}524	525	// ************************************************************************************************************************ 526	// AndroidElement          [22] = public java.util.List io.appium.java_client.MobileElement.findElementsByClassName(java.lang.String)527	// IOSElement              [21] = public java.util.List io.appium.java_client.MobileElement.findElementsByClassName(java.lang.String)528	// MobileElement           [18] = public java.util.List io.appium.java_client.MobileElement.findElementsByClassName(java.lang.String)529	public pureElements findElementsByClassName( java.lang.String Description ){530		return intFindElementsXXX( "findElementsByClassName", pureCore.elementMethod.className, Description );531	}532	533	// ************************************************************************************************************************ 534	// AndroidElement          [23] = public java.util.List io.appium.java_client.MobileElement.findElementsByCssSelector(java.lang.String)535	// IOSElement              [22] = public java.util.List io.appium.java_client.MobileElement.findElementsByCssSelector(java.lang.String)536	// MobileElement           [19] = public java.util.List io.appium.java_client.MobileElement.findElementsByCssSelector(java.lang.String)537	public pureElements findElementsByCssSelector( java.lang.String Description ){538		return intFindElementsXXX( "findElementsByCssSelector", pureCore.elementMethod.cssSelector, Description );539	}540	541	// ************************************************************************************************************************ 542	// AndroidElement          [24] = public java.util.List io.appium.java_client.MobileElement.findElementsByXPath(java.lang.String)543	// IOSElement              [23] = public java.util.List io.appium.java_client.MobileElement.findElementsByXPath(java.lang.String)544	// MobileElement           [20] = public java.util.List io.appium.java_client.MobileElement.findElementsByXPath(java.lang.String)545	public pureElements findElementsByXPath( java.lang.String Description ){546		return intFindElementsXXX( "findElementsByXPath", pureCore.elementMethod.xpath, Description );547	}548	549	// ************************************************************************************************************************ 550	// AndroidElement          [25] = public java.util.List io.appium.java_client.MobileElement.findElementsById(java.lang.String)551	// IOSElement              [24] = public java.util.List io.appium.java_client.MobileElement.findElementsById(java.lang.String)552	// MobileElement           [22] = public java.util.List io.appium.java_client.MobileElement.findElementsById(java.lang.String)553	public pureElements findElementsById( java.lang.String Description ){554		return intFindElementsXXX( "findElementsById", pureCore.elementMethod.id, Description );555	}556	557	// ************************************************************************************************************************ 558	// AndroidElement          [26] = public java.util.List io.appium.java_client.MobileElement.findElementsByAccessibilityId(java.lang.String)559	// IOSElement              [25] = public java.util.List io.appium.java_client.MobileElement.findElementsByAccessibilityId(java.lang.String)560	// MobileElement           [26] = public java.util.List io.appium.java_client.MobileElement.findElementsByAccessibilityId(java.lang.String)561	public pureElements findElementsByAccessibilityId( java.lang.String Description ){562		return intFindElementsXXX( "findElementsByAccessibilityId", pureCore.elementMethod.AccessibilityId, Description );563	}564		565	// ************************************************************************************************************************ 566	// AndroidElement          [27] = public org.openqa.selenium.Point io.appium.java_client.MobileElement.getCenter()567	// IOSElement              [26] = public org.openqa.selenium.Point io.appium.java_client.MobileElement.getCenter()568	// MobileElement           [25] = public org.openqa.selenium.Point io.appium.java_client.MobileElement.getCenter()569	public org.openqa.selenium.Point getCenter(){570		this.refresh();571		return (org.openqa.selenium.Point)this.pureElementMethodCall( "getCenter" );572	}573	// ************************************************************************************************************************ 574	// AndroidElement          [28] = public boolean org.openqa.selenium.remote.RemoteWebElement.equals(java.lang.Object)575	// IOSElement              [27] = public boolean org.openqa.selenium.remote.RemoteWebElement.equals(java.lang.Object)576	// MobileElement           [27] = public boolean org.openqa.selenium.remote.RemoteWebElement.equals(java.lang.Object)577	public boolean equalsL( Object equalsto ){578		this.refresh();579		return (boolean)this.pureElementMethodCall( "equals", equalsto );580	}581	582	// ************************************************************************************************************************ 583	// AndroidElement          [29] = public java.lang.String org.openqa.selenium.remote.RemoteWebElement.toString()584	// IOSElement              [28] = public java.lang.String org.openqa.selenium.remote.RemoteWebElement.toString()585	// MobileElement           [28] = public java.lang.String org.openqa.selenium.remote.RemoteWebElement.toString()586	public java.lang.String toStringL(){587		this.refresh();588		return (String)this.pureElementMethodCall( "toString" );589	}590	591	// ************************************************************************************************************************ 592	// AndroidElement          [30] = public int org.openqa.selenium.remote.RemoteWebElement.hashCode()593	// IOSElement              [29] = public int org.openqa.selenium.remote.RemoteWebElement.hashCode()594	// MobileElement           [29] = public int org.openqa.selenium.remote.RemoteWebElement.hashCode()595	public int hashCodeL(){596		this.refresh();597		return (int)this.pureElementMethodCall( "hashCode" );598	}599	600	// ************************************************************************************************************************ 601	// AndroidElement          [33] = public java.lang.String org.openqa.selenium.remote.RemoteWebElement.getId()602	// IOSElement              [32] = public java.lang.String org.openqa.selenium.remote.RemoteWebElement.getId()603	// MobileElement           [32] = public java.lang.String org.openqa.selenium.remote.RemoteWebElement.getId()604	public java.lang.String getId(){605		this.refresh();606		return (java.lang.String)this.pureElementMethodCall( "getId" );607	}608	// ************************************************************************************************************************ 609	// AndroidElement          [35] = public void org.openqa.selenium.remote.RemoteWebElement.setParent(org.openqa.selenium.remote.RemoteWebDriver)610	// IOSElement              [34] = public void org.openqa.selenium.remote.RemoteWebElement.setParent(org.openqa.selenium.remote.RemoteWebDriver)611	// MobileElement           [34] = public void org.openqa.selenium.remote.RemoteWebElement.setParent(org.openqa.selenium.remote.RemoteWebDriver)612	public void setParent( org.openqa.selenium.remote.RemoteWebDriver remoteWebDriver ){613		this.refresh();614		this.pureElementMethodCall( "setParent", remoteWebDriver );615	}616	// ************************************************************************************************************************ 617	// AndroidElement          [36] = public void org.openqa.selenium.remote.RemoteWebElement.setFileDetector(org.openqa.selenium.remote.FileDetector)618	// IOSElement              [35] = public void org.openqa.selenium.remote.RemoteWebElement.setFileDetector(org.openqa.selenium.remote.FileDetector)619	// MobileElement           [35] = public void org.openqa.selenium.remote.RemoteWebElement.setFileDetector(org.openqa.selenium.remote.FileDetector)620	public void setFileDetector( org.openqa.selenium.remote.FileDetector fileSelector ) {621		this.refresh();622		this.pureElementMethodCall( "setFileDetector", fileSelector );623	}624	625	// ************************************************************************************************************************ 626	// AndroidElement          [47] = public org.openqa.selenium.WebDriver org.openqa.selenium.remote.RemoteWebElement.getWrappedDriver()627	// IOSElement              [48] = public org.openqa.selenium.WebDriver org.openqa.selenium.remote.RemoteWebElement.getWrappedDriver()628	// MobileElement           [46] = public org.openqa.selenium.WebDriver org.openqa.selenium.remote.RemoteWebElement.getWrappedDriver()629/*	public pureDrivers getWrappedDriver(){630		this.refresh();631		Object SourceObject = this.pureElementMethodCall( "getWrappedDriver" );632		if ( SourceObject != null ) {633			pureDrivers newDriver = new pureDrivers();634			newDriver.DriverName = "WrappedDriver";635			newDriver.subDriverName = "";636			newDriver.mainDriver = SourceObject;637			return newDriver;638		}else {639			return null;640		}641	} */642	643	// ************************************************************************************************************************ 644	// AndroidElement          [48] = public org.openqa.selenium.interactions.internal.Coordinates org.openqa.selenium.remote.RemoteWebElement.getCoordinates()645	// IOSElement              [49] = public org.openqa.selenium.interactions.internal.Coordinates org.openqa.selenium.remote.RemoteWebElement.getCoordinates()646	// MobileElement           [47] = public org.openqa.selenium.interactions.internal.Coordinates org.openqa.selenium.remote.RemoteWebElement.getCoordinates()647	public org.openqa.selenium.interactions.internal.Coordinates getCoordinates(){648		this.refresh();649		return (org.openqa.selenium.interactions.internal.Coordinates)this.pureElementMethodCall( "getCoordinates" );650	}651	652	// ************************************************************************************************************************ 653	// AndroidElement          [49] = public java.util.Map org.openqa.selenium.remote.RemoteWebElement.toJson()654	// IOSElement              [46] = public java.util.Map org.openqa.selenium.remote.RemoteWebElement.toJson()655	// MobileElement           [48] = public java.util.Map org.openqa.selenium.remote.RemoteWebElement.toJson()656	public java.util.Map<?,?> toJson(){657		this.refresh();658		return (java.util.Map<?,?>)this.pureElementMethodCall( "toJson" );659	}660	661	// ************************************************************************************************************************ 662	// AndroidElement          [50] = public void org.openqa.selenium.remote.RemoteWebElement.setId(java.lang.String)663	// IOSElement              [47] = public void org.openqa.selenium.remote.RemoteWebElement.setId(java.lang.String)664	// MobileElement           [49] = public void org.openqa.selenium.remote.RemoteWebElement.setId(java.lang.String)665	public void setId( java.lang.String Value ) {666		this.refresh();667		this.pureElementMethodCall( "setId", Value );668	}669	670	// ************************************************************************************************************************ 671	// AndroidElement          [51] = public final void java.lang.Object.wait() throws java.lang.InterruptedException672	// IOSElement              [50] = public final void java.lang.Object.wait() throws java.lang.InterruptedException673	// MobileElement           [50] = public final void java.lang.Object.wait() throws java.lang.InterruptedException674	public void waitL(){675		this.refresh();676		this.pureElementMethodCall( "wait" );677	}678	679	// ************************************************************************************************************************ 680	// AndroidElement          [52] = public final void java.lang.Object.wait(long,int) throws java.lang.InterruptedException681	// IOSElement              [51] = public final void java.lang.Object.wait(long,int) throws java.lang.InterruptedException682	// MobileElement           [51] = public final void java.lang.Object.wait(long,int) throws java.lang.InterruptedException683	public void waitL( long waitdelay, int waitdelayms ){684		this.refresh();685		this.pureElementMethodCall( "wait", waitdelay, waitdelayms );686	}687	688	// ************************************************************************************************************************ 689	// AndroidElement          [53] = public final native void java.lang.Object.wait(long) throws java.lang.InterruptedException690	// IOSElement              [52] = public final native void java.lang.Object.wait(long) throws java.lang.InterruptedException691	// MobileElement           [52] = public final native void java.lang.Object.wait(long) throws java.lang.InterruptedException692	public void waitL( long waitdelay ){693		this.refresh();694		this.pureElementMethodCall( "wait", waitdelay );695	}696	697	// ************************************************************************************************************************ 698	// AndroidElement          [54] = public final native java.lang.Class java.lang.Object.getClass()699	// IOSElement              [53] = public final native java.lang.Class java.lang.Object.getClass()700	// MobileElement           [53] = public final native java.lang.Class java.lang.Object.getClass()701	public java.lang.Class<?> getClassL(){702		this.refresh();703		return (java.lang.Class<?>)this.pureElementMethodCall( "getClass" );704	}705	706	// ************************************************************************************************************************ 707	// AndroidElement          [55] = public final native void java.lang.Object.notify()708	// IOSElement              [54] = public final native void java.lang.Object.notify()709	// MobileElement           [54] = public final native void java.lang.Object.notify()710	public void notifyL(){711		this.refresh();712		this.pureElementMethodCall( "notify" );713	}714	715	// ************************************************************************************************************************ 716	// AndroidElement          [56] = public final native void java.lang.Object.notifyAll()717	// IOSElement              [55] = public final native void java.lang.Object.notifyAll()718	// MobileElement           [55] = public final native void java.lang.Object.notifyAll()719	public void notifyAllL(){720		this.refresh();721		this.pureElementMethodCall( "notifyAll" );722	}723	724	// ************************************************************************************************************************ 725	// AndroidElement          [57] = public default org.openqa.selenium.WebElement io.appium.java_client.FindsByAccessibilityId.findElementByAccessibilityId(java.lang.String)726	// IOSElement              [56] = public default org.openqa.selenium.WebElement io.appium.java_client.FindsByAccessibilityId.findElementByAccessibilityId(java.lang.String)727	// MobileElement           [56] = public default org.openqa.selenium.WebElement io.appium.java_client.FindsByAccessibilityId.findElementByAccessibilityId(java.lang.String)728	public pureElement findElementByAccessibilityId( String Description ){729		return this.intFindElementXXX( "findElementByAccessibilityId", pureCore.elementMethod.AccessibilityId, Description );730	}731	732	// ************************************************************************************************************************ 733	// AndroidElement          [58] = public default org.openqa.selenium.WebElement io.appium.java_client.FindsByAndroidUIAutomator.findElementByAndroidUIAutomator(java.lang.String)734	public pureElement findElementByAndroidUIAutomator( String Description ){735		return this.intFindElementXXX( "findElementByAndroidUIAutomator", pureCore.elementMethod.AndroidUIAutomator, Description );736	}737	// ************************************************************************************************************************ 738	// AndroidElement          [59] = public default java.util.List io.appium.java_client.FindsByAndroidUIAutomator.findElementsByAndroidUIAutomator(java.lang.String)739	public pureElements findElementsByAndroidUIAutomator( String Description ) {740		return this.intFindElementsXXX( "findElementsByAndroidUIAutomator", pureCore.elementMethod.AndroidUIAutomator, Description );741	}742	// ************************************************************************************************************************ 743	// IOSElement              [57] = public default org.openqa.selenium.WebElement io.appium.java_client.FindsByIosUIAutomation.findElementByIosUIAutomation(java.lang.String)744	public pureElement findElementByIosUIAutomation( String Description ){745		return this.intFindElementXXX( "findElementByIosUIAutomation", pureCore.elementMethod.IosUIAutomation, Description );746	}747	// ************************************************************************************************************************ 748	// IOSElement              [58] = public default java.util.List io.appium.java_client.FindsByIosUIAutomation.findElementsByIosUIAutomation(java.lang.String)749	public pureElements findElementsByIosUIAutomation( String Description ) {750		return this.intFindElementsXXX( "findElementsByIosUIAutomation", pureCore.elementMethod.IosUIAutomation, Description );751	}752	// ************************************************************************************************************************ 753	// IOSElement              [59] = public default org.openqa.selenium.WebElement io.appium.java_client.FindsByIosNSPredicate.findElementByIosNsPredicate(java.lang.String)754	public pureElement findElementByIosNsPredicate( String Description ){755		return this.intFindElementXXX( "findElementByIosNsPredicate", pureCore.elementMethod.IosNsPredicate, Description );756	}757	// ************************************************************************************************************************ 758	// IOSElement              [60] = public default java.util.List io.appium.java_client.FindsByIosNSPredicate.findElementsByIosNsPredicate(java.lang.String)759	public pureElements findElementsByIosNsPredicate( String Description ) {760		return this.intFindElementsXXX( "findElementsByIosNsPredicate", pureCore.elementMethod.IosNsPredicate, Description );761	}762	// ************************************************************************************************************************ 763	// IOSElement              [61] = public default org.openqa.selenium.WebElement io.appium.java_client.FindsByIosClassChain.findElementByIosClassChain(java.lang.String)764	public pureElement findElementByIosClassChain( String Description ){765		return this.intFindElementXXX( "findElementByIosClassChain", pureCore.elementMethod.IosClassChain, Description );766	}767	// ************************************************************************************************************************ 768	// IOSElement              [62] = public default java.util.List io.appium.java_client.FindsByIosClassChain.findElementsByIosClassChain(java.lang.String)769	public pureElements findElementsByIosClassChain( String Description ) {770		return this.intFindElementsXXX( "findElementsByIosClassChain", pureCore.elementMethod.IosClassChain, Description );771	}772	// ************************************************************************************************************************ 773	private void refresh() {774		// Si l'Element n'a pas encore ete cherche, ou que son rafraichissement doit etre realise.775		if ( this.theElement == null || this.refreshMethod == 1 ) { // || this.refrehCode != pureCore.getLastLogCat() ) {776			pureDriverDetails myDriver = null;777			if ( this.driverLink == -1 ) {778				myDriver = pureDrivers.getCurrentDriverDetails();779				// this.driverToUse = myDriver;780			}else {781				myDriver = this.driverToUse;782			}783			this.theElement = this.detection();784			// Tout d'abord on réalise une attente pour trouver l'élément.785			/*try {786				this.theElement = (Object)(new WebDriverWait( (WebDriver)pureCore.getCurrentDriver(), pureCore.getMaxWaitDelay() )787							.until( ExpectedConditions.presenceOfElementLocated( By.xpath( pureCore.MethodToLocator( this.eMethod, this.ePath ) ) ) ) );788			}catch( Exception e ) {789				pureErrorHandler.castError( pureErrorHandler.exceptions.getType( e ), "pureElement.refresh()", this.eName, pureCore.MethodToLocator( this.eMethod, this.ePath ) );790			} */791			if ( this.parent == null ) {792				this.theElement = (Object)pureDrivers.findElementWE( pureCore.MethodToLocator( this.eMethod, this.ePath ), myDriver );793			}else {794				this.theElement = (Object)this.parent.findElement( pureCore.MethodToLocator( this.eMethod,  this.ePath ) );795			}796			// this.centerOnScreen();797		}798	}799	public Object myObject = null;800	private Object detection() {801		pureDriverDetails myDriver = null;802		if ( this.driverLink == -1 ) {803			myDriver = pureDrivers.getCurrentDriverDetails();804		}else {805			myDriver = this.driverToUse;806		}807		try {808			WebDriverWait objWait = new WebDriverWait( (WebDriver)myDriver.mainDriver, 20, 500 );809			objWait.until( new ExpectedCondition<Boolean>() {810				private pureElement myElement;811				private pureDriverDetails myDriver;812				private ExpectedCondition<Boolean> init( pureElement myElement, pureDriverDetails myDriver ){813					this.myElement = myElement;814					this.myDriver = myDriver;815					return this;816				}817				public Boolean apply(WebDriver wDriver) {818					if( this.myElement.parent == null ) {819						this.myElement.theElement = (Object)pureDrivers.findElementWE( pureCore.MethodToLocator( this.myElement.eMethod, this.myElement.ePath ), this.myDriver );820					}else {821						this.myElement.theElement = (Object)this.myElement.parent.findElement( pureCore.MethodToLocator( this.myElement.eMethod,  this.myElement.ePath ) );822					}823					return ( this.myElement.theElement != null );824				}825			}.init( this, myDriver ) );826		827		}catch( Exception e ) {828			pureErrorHandler.castError( pureErrorHandler.exceptions.getType( e ), "pureElement.refresh()", this.eName, pureCore.MethodToLocator( this.eMethod, this.ePath ).toString() );829		}830		return myObject;831	}832	// ************************************************************************************************************************ 833private void centerOnScreen() {834	pureDriverDetails myDriver = pureDrivers.getCurrentDriverDetails();835	// Positionner l'objet au milieu de l'ecran si possible836	if ( this.theElement !=null ) {837		// On recupere d'abord les coordonnees et dimensions de l'objet838		Point pePosition = this.getLocation();839		Dimension peDimension = this.getSize();840				// On recupere ensuite les coordonnees et dimensions de l'ecran visible841		Rectangle cdRectangle = pureDrivers.GetDisplayArea();842		// Si l'objet est plus haut que l'ecran visible (et partiellement ou totalement hors ecran) :843		if ( pePosition.getY()  < cdRectangle.getY() ) {844			int yShift = ( cdRectangle.getY() - pePosition.getY() ) + ( ( cdRectangle.getHeight() / 2 ) - ( peDimension.getHeight() / 2 ) );845			// Scroller vers le haut de la page, d'une valeur de yShift pixels846	      	JavascriptExecutor jse = (JavascriptExecutor)myDriver.mainDriver;847	        jse.executeScript("window.scrollTo( " + ( cdRectangle.getY() - yShift ) + "," + "0" + ")" );848		}849		// Si l'objet est plus bas que l'ecran visible (et partiellement ou totalement hors ecran) :850		if ( ( pePosition.getY() + peDimension.getHeight() ) > ( cdRectangle.getY() + cdRectangle.getHeight() ) ){851			int yShift = ( ( pePosition.getY() + peDimension.getHeight() ) - ( cdRectangle.getY() + cdRectangle.getHeight() ) ) + 852				( ( cdRectangle.getHeight() / 2 ) - ( peDimension.getHeight() / 2 ) );...Source:BasicOperation.java  
...450//        String thumbMachine = page.getXpathByAutomationId("DownPageButton");451//        org.openqa.selenium.remote.RemoteWebElement thumbMachineElement = driver.findElementByXPath(thumbMachine);452//        thumbMachineElement.sendKeys("ttttttt");453//        thumbMachineElement.click();454//        thumbMachineElement.getLocation();455//        String machine =   thumbMachineElement.getText();456////        page.xpathNameList.clear();457////        page.xpathAutomationIdList.clear();458////        page.getXpathByName(driver.getPageSource());459//460//        return machineList;461//    }462    // TODO Auto-generated method stub:463    //  This Method is to update/add machine characterization.464    public boolean updateMachineCharacterization(String machineName) {465         Reporter.log("---------------------------MOSAIQ : start to add machine characterization---------------------------");466        try {467            Thread.sleep(3000);468        } catch (InterruptedException e) {...Source:RemoteWebElementWrapper.java  
...465		return original.isDisplayed();466	}467	/**468	 * @return469	 * @see org.openqa.selenium.remote.RemoteWebElement#getLocation()470	 */471	@Override472	public Point getLocation() {473		return original.getLocation();474	}475	/**476	 * @return477	 * @see org.openqa.selenium.remote.RemoteWebElement#getSize()478	 */479	@Override480	public Dimension getSize() {481		return original.getSize();482	}483	/**484	 * @return485	 * @see org.openqa.selenium.remote.RemoteWebElement#getRect()486	 */487	@Override...Source:ZetaOSXDriver.java  
...210            final NSPoint elementSize = NSPoint.fromString(this.getAttribute(AX_SIZE));211            return new Dimension(elementSize.x(), elementSize.y());212        }213        @Override214        public Point getLocation() {215            final NSPoint elementLocation = NSPoint.fromString(this.getAttribute(AX_POSITION));216            return new Point(elementLocation.x(), elementLocation.y());217        }218        @Override219        public <X> X getScreenshotAs(OutputType<X> outputType) throws WebDriverException {220            Point elLocation = this.getLocation();221            Dimension elSize = this.getSize();222            if (OutputType.BASE64.equals(outputType)) {223                throw new WebDriverException("Base64 screenshot not supported yet");224            } else if (OutputType.BYTES.equals(outputType)) {225                return (X) bufferedImageAsByteArray(robot.createScreenCapture(new Rectangle(226                        elLocation.getX(), elLocation.getY(), elSize.getWidth(), elSize.getHeight())));227            } else if (OutputType.FILE.equals(outputType)) {228                throw new WebDriverException("File screenshot not supported yet");229            } else {230                throw new WebDriverException("Unsupported OutputType selection");231            }232        }233        @Override234        public String toString() {235            return originalElement.toString();236        }237    }238    protected class ZetaRemoteWebDriverOptions extends RemoteWebDriverOptions {239        @Beta240        @Override241        public WebDriver.Window window() {242            final WebElement window = findElement(windowLocator);243            return new ZetaRemoteWindow(window);244        }245        @Beta246        protected class ZetaRemoteWindow extends RemoteWindow {247            private final WireRemoteWebElement window;248            public ZetaRemoteWindow(WebElement window) {249                this.window = new WireRemoteWebElement((RemoteWebElement) window);250            }251            public <X> X getScreenshotAs(OutputType<X> outputType) throws WebDriverException {252                return window.getScreenshotAs(outputType);253            }254            @Override255            public Dimension getSize() {256                return window.getSize();257            }258            @Override259            public Point getPosition() {260                return window.getLocation();261            }262        }263    }264}...Source:Scroller.java  
...95        WebElement element = e;96        if (Objects.equals(element.getTagName(), "option")) {97            element = e.findElement(By.xpath("..")); // scroll select into view not option98        }99        final int eYCoord = element.getLocation().getY();100        final int eXCoord = element.getLocation().getX();101        final String id = element.getAttribute("id");102        final JavascriptExecutor executor = (JavascriptExecutor) driver;103        // Wait until web element is successfully scrolled.104        try {105            new Wait<>(Boolean.TRUE)106                    .withTimeout(5, TimeUnit.SECONDS) // Wall-clock time107                    .until(() -> (Boolean) executor.executeScript(scrollJs, eYCoord, eXCoord, id))108            ;109        } catch (TimeoutException ex) {110            // Scrolling failed, but sometimes the element to click is already visible, let the test continue and eventually fail later111            // This log message should be sufficient to diagnose the issue112            LOGGER.log(Level.WARNING, "Scrolling failed, letting the test to continue anyways, but \"Element is not clickable\" error will likely be thrown", ex);113        }114    }...Source:PageView.java  
...31	 */32	public void tap(IDriver driver, WebElement element, Double duration) {33		JavascriptExecutor js = (JavascriptExecutor) driver;34		HashMap<String, Double> tapObject = new HashMap<String, Double>();35		tapObject.put("x", (double) element.getLocation().getX());36		tapObject.put("y", (double) element.getLocation().getY());37		tapObject.put("duration", duration);38		js.executeScript("mobile: tap", tapObject);39	}40	/**41	 * Tap element by id.42	 * 43	 * @param driver44	 *            the driver45	 * @param element46	 *            the element47	 */48	public void tapElementById(IDriver driver, RemoteWebElement element) {49		JavascriptExecutor js = (JavascriptExecutor) driver;50		HashMap<String, Object> tapObject = new HashMap<String, Object>();...Source:AndroidNativeElement.java  
...75	@Override76	public Coordinates getCoordinates() {77		return new Coordinates() {78			public Point onScreen() {79				return getLocation();80			}81			public Point inViewPort() {82				throw new UnsupportedOperationException("Not supported yet.");83			}84			public Point onPage() {85				return getLocation();86			}87			public Object getAuxiliary() {88				throw new UnsupportedOperationException("Not supported yet.");89			}90		};91	}92}...Source:MobileElement.java  
...55		execute(MobileCommand.SET_VALUE, builder.build());56	}5758	public Point getCenter() {59		Point upperLeft = this.getLocation();60		Dimension dimensions = this.getSize();61		return new Point(upperLeft.getX() + dimensions.getWidth() / 2, upperLeft.getY() + dimensions.getHeight() / 2);62	}6364	@Override65	public void pinch() {66		((AppiumDriver) parent).pinch(this);	67	}6869	@Override70	public void tap(int fingers, int duration) {71		((AppiumDriver) parent).tap(fingers, this, duration);		72	}73
...getLocation
Using AI Code Generation
1import org.openqa.selenium.By;2import org.openqa.selenium.Dimension;3import org.openqa.selenium.Point;4import org.openqa.selenium.WebElement;5import org.openqa.selenium.remote.RemoteWebElement;6import org.testng.annotations.Test;7public class RemoteWebElementExample extends BaseTest {8    public void remoteWebElementExample() {9        WebElement element = driver.findElement(By.name("q"));10        Point point = element.getLocation();11        System.out.println("Element's Position: " + element.getLocation());12        int xcord = point.getX();13        int ycord = point.getY();14        System.out.println("Element's Position from left side Is: " + xcord + " pixels.");15        System.out.println("Element's Position from top Is: " + ycord + " pixels.");16        Dimension dim = element.getSize();17        System.out.println("Element's width Is: " + dim.getWidth() + " pixels.");18        System.out.println("Element's height Is: " + dim.getHeight() + " pixels.");19        System.out.println("Element's Location: " + element.getRect().getPoint());20        System.out.println("Element's Size: " + element.getRect().getDimension());21        RemoteWebElement remoteWebElement = (RemoteWebElement) element;22        System.out.println("Element's Location: " + remoteWebElement.getLocation());23        System.out.println("Element's Size: " + remoteWebElement.getSize());24    }25}getLocation
Using AI Code Generation
1import org.openqa.selenium.By;2import org.openqa.selenium.WebDriver;3import org.openqa.selenium.WebElement;4import org.openqa.selenium.chrome.ChromeDriver;5public class GetLocation {6	public static void main(String[] args) {7		System.setProperty("webdriver.chrome.driver", "C:\\Users\\User\\Downloads\\chromedriver_win32\\chromedriver.exe");8		WebDriver driver = new ChromeDriver();9		WebElement googleSearch = driver.findElement(By.name("q"));10		System.out.println(googleSearch.getLocation());11		driver.close();12	}13}getLocation
Using AI Code Generation
1import org.openqa.selenium.By;2import org.openqa.selenium.WebDriver;3import org.openqa.selenium.WebElement;4import org.openqa.selenium.chrome.ChromeDriver;5import org.openqa.selenium.remote.RemoteWebElement;6import org.openqa.selenium.support.ui.ExpectedConditions;7import org.openqa.selenium.support.ui.WebDriverWait;8public class GetElementLocation {9public static void main(String[] args) throws InterruptedException {10System.setProperty("webdriver.chrome.driver", "C:\\chromedriver.exe");11WebDriver driver = new ChromeDriver();12driver.manage().window().maximize();13WebDriverWait wait = new WebDriverWait(driver, 10);14org.openqa.selenium.Point point = ((RemoteWebElement) element).getLocation();15System.out.println("Location of the element is: "+point);16}17}18Location of the element is: (20, 100)getLocation
Using AI Code Generation
1import org.openqa.selenium.By;2import org.openqa.selenium.Dimension;3import org.openqa.selenium.Point;4import org.openqa.selenium.WebDriver;5import org.openqa.selenium.WebElement;6import org.openqa.selenium.firefox.FirefoxDriver;7import org.openqa.selenium.remote.RemoteWebElement;8public class RemoteWebElementMethods {9    public static void main(String[] args) {10        System.setProperty("webdriver.gecko.driver", "C:\\geckodriver.exe");11        WebDriver driver = new FirefoxDriver();12        WebElement element = driver.findElement(By.name("q"));13        Point point = ((RemoteWebElement) element).getLocation();14        System.out.println("Location of the element is: " + point);15        String value = ((RemoteWebElement) element).getAttribute("value");16        System.out.println("Value of the element is: " + value);17        Dimension dimension = ((RemoteWebElement) element).getSize();18        System.out.println("Size of the element is: " + dimension);19        String tagName = ((RemoteWebElement)getLocation
Using AI Code Generation
1import org.openqa.selenium.remote.RemoteWebElement2def element = driver.findElement(By.id("some_id"))3def location = ((RemoteWebElement) element).getLocation()4println "Element location: ${location}"5import org.openqa.selenium.JavascriptExecutor6def element = driver.findElement(By.id("some_id"))7def location = ((JavascriptExecutor) driver).executeScript("return arguments[0].getBoundingClientRect()", element)8println "Element location: ${location}"9We can also use the getBoundingClientRect() method of the Element class of the Selenium WebDriver API. This method returns the bounding rectangle of the element. The returned object contains the following properties:10def element = driver.findElement(By.id("some_id"))11def location = element.getBoundingClientRect()12println "Element location: ${location}"13There is also a way of getting element location using Selenium Grid. We can use the getRect() method of the RemoteWebElement class. This method returns the bounding rectangle of the element. The returned object contains the following properties:14import org.openqa.selenium.remote.RemoteWebElement15def element = driver.findElement(By.id("some_id"))16def location = ((RemoteWebElement) element).getRect()17println "Element location: ${location}"LambdaTest’s Selenium 4 tutorial is covering every aspects of Selenium 4 testing with examples and best practices. Here you will learn basics, such as how to upgrade from Selenium 3 to Selenium 4, to some advanced concepts, such as Relative locators and Selenium Grid 4 for Distributed testing. Also will learn new features of Selenium 4, such as capturing screenshots of specific elements, opening a new tab or window on the browser, and new protocol adoptions.
Upgrading From Selenium 3 To Selenium 4?: In this chapter, learn in detail how to update Selenium 3 to Selenium 4 for Java binding. Also, learn how to upgrade while using different build tools such as Maven or Gradle and get comprehensive guidance for upgrading Selenium.
What’s New In Selenium 4 & What’s Being Deprecated? : Get all information about new implementations in Selenium 4, such as W3S protocol adaption, Optimized Selenium Grid, and Enhanced Selenium IDE. Also, learn what is deprecated for Selenium 4, such as DesiredCapabilites and FindsBy methods, etc.
Selenium 4 With Python: Selenium supports all major languages, such as Python, C#, Ruby, and JavaScript. In this chapter, learn how to install Selenium 4 for Python and the features of Python in Selenium 4, such as Relative locators, Browser manipulation, and Chrom DevTool protocol.
Selenium 4 Is Now W3C Compliant: JSON Wireframe protocol is retiring from Selenium 4, and they are adopting W3C protocol to learn in detail about the advantages and impact of these changes.
How To Use Selenium 4 Relative Locator? : Selenium 4 came with new features such as Relative Locators that allow constructing locators with reference and easily located constructors nearby. Get to know its different use cases with examples.
Selenium Grid 4 Tutorial For Distributed Testing: Selenium Grid 4 allows you to perform tests over different browsers, OS, and device combinations. It also enables parallel execution browser testing, reads up on various features of Selenium Grid 4 and how to download it, and runs a test on Selenium Grid 4 with best practices.
Selenium Video Tutorials: Binge on video tutorials on Selenium by industry experts to get step-by-step direction from automating basic to complex test scenarios with Selenium.
LambdaTest also provides certification for Selenium testing to accelerate your career in Selenium automation testing.
Get 100 minutes of automation test minutes FREE!!
