Best Selenium code snippet using org.openqa.selenium.remote.RemoteWebElement.findElements
Source:pureElement.java
...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....
Source:RemoteWebElementWrapper.java
...133 throw new NeotysWrappingException("Issue with NeoLoad proxy.", e);134 } 135 }136 @Override137 public List<WebElement> findElements(final By by) {138 if (!SeleniumProxyConfig.isEnabled()) {139 return original.findElements(by);140 }141 try {142 final Method method = RemoteWebElement.class.getDeclaredMethod("findElements", (new Class<?>[]{By.class}));143 return proxySendHelper.sendAndReturn(METHODS_ALWAYS_SEND, METHODS_SEND_ON_EXCEPTION_ONLY, Collections.<String>emptyList(),144 webDriver, original, method, new Object[]{by});145 } catch (final IllegalAccessException | InvocationTargetException | NoSuchMethodException | SecurityException e) {146 throw new NeotysWrappingException("Issue with NeoLoad proxy.", e);147 } 148 }149 @Override150 public WebElement findElement(final By by) {151 if (!SeleniumProxyConfig.isEnabled()) {152 return original.findElement(by);153 }154 try {155 final Method method = RemoteWebElement.class.getDeclaredMethod("findElement", (new Class<?>[]{By.class}));156 return proxySendHelper.sendAndReturn(METHODS_ALWAYS_SEND, METHODS_SEND_ON_EXCEPTION_ONLY, Collections.<String>emptyList(),157 webDriver, original, method, new Object[]{by});158 } catch (final IllegalAccessException | InvocationTargetException | NoSuchMethodException | SecurityException e) {159 throw new NeotysWrappingException("Issue with NeoLoad proxy.", e);160 } 161 }162 @Override163 public WebElement findElementById(final String using) {164 if (!SeleniumProxyConfig.isEnabled()) {165 return original.findElementById(using);166 }167 try {168 final Method method = RemoteWebElement.class.getDeclaredMethod("findElementById", (new Class<?>[]{String.class}));169 return proxySendHelper.sendAndReturn(METHODS_ALWAYS_SEND, METHODS_SEND_ON_EXCEPTION_ONLY, Collections.<String>emptyList(),170 webDriver, original, method, new Object[]{using});171 } catch (final IllegalAccessException | InvocationTargetException | NoSuchMethodException | SecurityException e) {172 throw new NeotysWrappingException("Issue with NeoLoad proxy.", e);173 } 174 }175 @Override176 public List<WebElement> findElementsById(final String using) {177 if (!SeleniumProxyConfig.isEnabled()) {178 return original.findElementsById(using);179 }180 try {181 final Method method = RemoteWebElement.class.getDeclaredMethod("findElementsById", (new Class<?>[]{String.class}));182 return proxySendHelper.sendAndReturn(METHODS_ALWAYS_SEND, METHODS_SEND_ON_EXCEPTION_ONLY, Collections.<String>emptyList(),183 webDriver, original, method, new Object[]{using});184 } catch (final IllegalAccessException | InvocationTargetException | NoSuchMethodException | SecurityException e) {185 throw new NeotysWrappingException("Issue with NeoLoad proxy.", e);186 } 187 }188 @Override189 public WebElement findElementByLinkText(final String using) {190 if (!SeleniumProxyConfig.isEnabled()) {191 return original.findElementByLinkText(using);192 }193 try {194 final Method method = RemoteWebElement.class.getDeclaredMethod("findElementByLinkText", (new Class<?>[]{String.class}));195 return proxySendHelper.sendAndReturn(METHODS_ALWAYS_SEND, METHODS_SEND_ON_EXCEPTION_ONLY, Collections.<String>emptyList(),196 webDriver, original, method, new Object[]{using});197 } catch (final IllegalAccessException | InvocationTargetException | NoSuchMethodException | SecurityException e) {198 throw new NeotysWrappingException("Issue with NeoLoad proxy.", e);199 } 200 }201 @Override202 public List<WebElement> findElementsByLinkText(final String using) {203 if (!SeleniumProxyConfig.isEnabled()) {204 return original.findElementsByLinkText(using);205 }206 try {207 final Method method = RemoteWebElement.class.getDeclaredMethod("findElementsByLinkText", (new Class<?>[]{String.class}));208 return proxySendHelper.sendAndReturn(METHODS_ALWAYS_SEND, METHODS_SEND_ON_EXCEPTION_ONLY, Collections.<String>emptyList(),209 webDriver, original, method, new Object[]{using});210 } catch (final IllegalAccessException | InvocationTargetException | NoSuchMethodException | SecurityException e) {211 throw new NeotysWrappingException("Issue with NeoLoad proxy.", e);212 } 213 }214 @Override215 public WebElement findElementByName(final String using) {216 if (!SeleniumProxyConfig.isEnabled()) {217 return original.findElementByName(using);218 }219 try {220 final Method method = RemoteWebElement.class.getDeclaredMethod("findElementByName", (new Class<?>[]{String.class}));221 return proxySendHelper.sendAndReturn(METHODS_ALWAYS_SEND, METHODS_SEND_ON_EXCEPTION_ONLY, Collections.<String>emptyList(),222 webDriver, original, method, new Object[]{using});223 } catch (final IllegalAccessException | InvocationTargetException | NoSuchMethodException | SecurityException e) {224 throw new NeotysWrappingException("Issue with NeoLoad proxy.", e);225 } 226 }227 @Override228 public List<WebElement> findElementsByName(final String using) {229 if (!SeleniumProxyConfig.isEnabled()) {230 return original.findElementsByName(using);231 }232 try {233 final Method method = RemoteWebElement.class.getDeclaredMethod("findElementsByName", (new Class<?>[]{String.class}));234 return proxySendHelper.sendAndReturn(METHODS_ALWAYS_SEND, METHODS_SEND_ON_EXCEPTION_ONLY, Collections.<String>emptyList(),235 webDriver, original, method, new Object[]{using});236 } catch (final IllegalAccessException | InvocationTargetException | NoSuchMethodException | SecurityException e) {237 throw new NeotysWrappingException("Issue with NeoLoad proxy.", e);238 } 239 }240 @Override241 public WebElement findElementByClassName(final String using) {242 if (!SeleniumProxyConfig.isEnabled()) {243 return original.findElementByClassName(using);244 }245 try {246 final Method method = RemoteWebElement.class.getDeclaredMethod("findElementByClassName", (new Class<?>[]{String.class}));247 return proxySendHelper.sendAndReturn(METHODS_ALWAYS_SEND, METHODS_SEND_ON_EXCEPTION_ONLY, Collections.<String>emptyList(),248 webDriver, original, method, new Object[]{using});249 } catch (final IllegalAccessException | InvocationTargetException | NoSuchMethodException | SecurityException e) {250 throw new NeotysWrappingException("Issue with NeoLoad proxy.", e);251 } 252 }253 @Override254 public List<WebElement> findElementsByClassName(final String using) {255 if (!SeleniumProxyConfig.isEnabled()) {256 return original.findElementsByClassName(using);257 }258 try {259 final Method method = RemoteWebElement.class.getDeclaredMethod("findElementsByClassName", (new Class<?>[]{String.class}));260 return proxySendHelper.sendAndReturn(METHODS_ALWAYS_SEND, METHODS_SEND_ON_EXCEPTION_ONLY, Collections.<String>emptyList(),261 webDriver, original, method, new Object[]{using});262 } catch (final IllegalAccessException | InvocationTargetException | NoSuchMethodException | SecurityException e) {263 throw new NeotysWrappingException("Issue with NeoLoad proxy.", e);264 } 265 }266 @Override267 public WebElement findElementByCssSelector(final String using) {268 if (!SeleniumProxyConfig.isEnabled()) {269 return original.findElementByCssSelector(using);270 }271 try {272 final Method method = RemoteWebElement.class.getDeclaredMethod("findElementByCssSelector", (new Class<?>[]{String.class}));273 return proxySendHelper.sendAndReturn(METHODS_ALWAYS_SEND, METHODS_SEND_ON_EXCEPTION_ONLY, Collections.<String>emptyList(),274 webDriver, original, method, new Object[]{using});275 } catch (final IllegalAccessException | InvocationTargetException | NoSuchMethodException | SecurityException e) {276 throw new NeotysWrappingException("Issue with NeoLoad proxy.", e);277 } 278 }279 @Override280 public List<WebElement> findElementsByCssSelector(final String using) {281 if (!SeleniumProxyConfig.isEnabled()) {282 return original.findElementsByCssSelector(using);283 }284 try {285 final Method method = RemoteWebElement.class.getDeclaredMethod("findElementsByCssSelector", (new Class<?>[]{String.class}));286 return proxySendHelper.sendAndReturn(METHODS_ALWAYS_SEND, METHODS_SEND_ON_EXCEPTION_ONLY, Collections.<String>emptyList(),287 webDriver, original, method, new Object[]{using});288 } catch (final IllegalAccessException | InvocationTargetException | NoSuchMethodException | SecurityException e) {289 throw new NeotysWrappingException("Issue with NeoLoad proxy.", e);290 } 291 }292 @Override293 public WebElement findElementByXPath(final String using) {294 if (!SeleniumProxyConfig.isEnabled()) {295 return original.findElementByXPath(using);296 }297 try {298 final Method method = RemoteWebElement.class.getDeclaredMethod("findElementByXPath", (new Class<?>[]{String.class}));299 return proxySendHelper.sendAndReturn(METHODS_ALWAYS_SEND, METHODS_SEND_ON_EXCEPTION_ONLY, Collections.<String>emptyList(),300 webDriver, original, method, new Object[]{using});301 } catch (final IllegalAccessException | InvocationTargetException | NoSuchMethodException | SecurityException e) {302 throw new NeotysWrappingException("Issue with NeoLoad proxy.", e);303 } 304 }305 @Override306 public List<WebElement> findElementsByXPath(final String using) {307 if (!SeleniumProxyConfig.isEnabled()) {308 return original.findElementsByXPath(using);309 }310 try {311 final Method method = RemoteWebElement.class.getDeclaredMethod("findElementsByXPath", (new Class<?>[]{String.class}));312 return proxySendHelper.sendAndReturn(METHODS_ALWAYS_SEND, METHODS_SEND_ON_EXCEPTION_ONLY, Collections.<String>emptyList(),313 webDriver, original, method, new Object[]{using});314 } catch (final IllegalAccessException | InvocationTargetException | NoSuchMethodException | SecurityException e) {315 throw new NeotysWrappingException("Issue with NeoLoad proxy.", e);316 } 317 }318 @Override319 public WebElement findElementByPartialLinkText(final String using) {320 if (!SeleniumProxyConfig.isEnabled()) {321 return original.findElementByPartialLinkText(using);322 }323 try {324 final Method method = RemoteWebElement.class.getDeclaredMethod("findElementByPartialLinkText", (new Class<?>[]{String.class}));325 return proxySendHelper.sendAndReturn(METHODS_ALWAYS_SEND, METHODS_SEND_ON_EXCEPTION_ONLY, Collections.<String>emptyList(),326 webDriver, original, method, new Object[]{using});327 } catch (final IllegalAccessException | InvocationTargetException | NoSuchMethodException | SecurityException e) {328 throw new NeotysWrappingException("Issue with NeoLoad proxy.", e);329 } 330 }331 @Override332 public List<WebElement> findElementsByPartialLinkText(final String using) {333 if (!SeleniumProxyConfig.isEnabled()) {334 return original.findElementsByPartialLinkText(using);335 }336 try {337 final Method method = RemoteWebElement.class.getDeclaredMethod("findElementsByPartialLinkText", (new Class<?>[]{String.class}));338 return proxySendHelper.sendAndReturn(METHODS_ALWAYS_SEND, METHODS_SEND_ON_EXCEPTION_ONLY, Collections.<String>emptyList(),339 webDriver, original, method, new Object[]{using});340 } catch (final IllegalAccessException | InvocationTargetException | NoSuchMethodException | SecurityException e) {341 throw new NeotysWrappingException("Issue with NeoLoad proxy.", e);342 } 343 }344 @Override345 public WebElement findElementByTagName(final String using) {346 if (!SeleniumProxyConfig.isEnabled()) {347 return original.findElementByTagName(using);348 }349 try {350 final Method method = RemoteWebElement.class.getDeclaredMethod("findElementByTagName", (new Class<?>[]{String.class}));351 return proxySendHelper.sendAndReturn(METHODS_ALWAYS_SEND, METHODS_SEND_ON_EXCEPTION_ONLY, Collections.<String>emptyList(),352 webDriver, original, method, new Object[]{using});353 } catch (final IllegalAccessException | InvocationTargetException | NoSuchMethodException | SecurityException e) {354 throw new NeotysWrappingException("Issue with NeoLoad proxy.", e);355 } 356 }357 @Override358 public List<WebElement> findElementsByTagName(final String using) {359 if (!SeleniumProxyConfig.isEnabled()) {360 return original.findElementsByTagName(using);361 }362 try {363 final Method method = RemoteWebElement.class.getDeclaredMethod("findElementsByTagName", (new Class<?>[]{String.class}));364 return proxySendHelper.sendAndReturn(METHODS_ALWAYS_SEND, METHODS_SEND_ON_EXCEPTION_ONLY, Collections.<String>emptyList(),365 webDriver, original, method, new Object[]{using});366 } catch (final IllegalAccessException | InvocationTargetException | NoSuchMethodException | SecurityException e) {367 throw new NeotysWrappingException("Issue with NeoLoad proxy.", e);368 } 369 }370 @Override371 public WebDriver getWrappedDriver() {372 if (!SeleniumProxyConfig.isEnabled()) {373 return original.getWrappedDriver();374 }375 return (WebDriver) wrapperUtils.wrapIfNecessary(webDriver, super.getWrappedDriver());376 }377 @Override...
Source:Factory.java
...31 *32 * @param url url of the server33 * @param desiredCapabilities desired capabilities for the session34 * @param <T> the required type of class which implement {@link org.openqa.selenium.WebElement}.35 * Instances of the defined type will be returned via findElement* and findElements*.36 * Warning (!!!). Allowed types:37 * {@link org.openqa.selenium.WebElement}38 * {@link org.openqa.selenium.remote.RemoteWebElement}39 * {@link io.appium.java_client.MobileElement}40 * {@link io.appium.java_client.android.AndroidElement}41 * @return enhanced Android driver42 */43 public static <T extends WebElement> EnhancedAndroidDriver<T> createAndroidDriver(URL url, DesiredCapabilities desiredCapabilities) {44 return provider.createAndroidDriver(url, desiredCapabilities);45 }46 /**47 * Create enhanced android driver, use in place of {@link io.appium.java_client.android.AndroidDriver#AndroidDriver(URL, HttpClient.Factory, Capabilities)}48 * @param url of the server49 * @param httpClientFactory http client factory50 * @param desiredCapabilities desired capabilities for the session51 * @param <T> the required type of class which implement {@link org.openqa.selenium.WebElement}.52 * Instances of the defined type will be returned via findElement* and findElements*.53 * Warning (!!!). Allowed types:54 * {@link org.openqa.selenium.WebElement}55 * {@link org.openqa.selenium.remote.RemoteWebElement}56 * {@link io.appium.java_client.MobileElement}57 * {@link io.appium.java_client.android.AndroidElement}58 * @return enhanced Android driver59 */60 public static <T extends WebElement> EnhancedAndroidDriver<T> createAndroidDriver(URL url, HttpClient.Factory httpClientFactory, Capabilities desiredCapabilities) {61 return provider.createAndroidDriver(url, httpClientFactory, desiredCapabilities);62 }63 /**64 * Create enhanced android driver, use in place of {@link io.appium.java_client.android.AndroidDriver#AndroidDriver(AppiumDriverLocalService, Capabilities)}65 * @param service local driver service. Warning: not supported in Xamarin test cloud.66 * @param desiredCapabilities desired capabilities for the session67 * @return enhanced Android driver68 * @param <T> the required type of class which implement {@link org.openqa.selenium.WebElement}.69 * Instances of the defined type will be returned via findElement* and findElements*.70 * Warning (!!!). Allowed types:71 * {@link org.openqa.selenium.WebElement}72 * {@link org.openqa.selenium.remote.RemoteWebElement}73 * {@link io.appium.java_client.MobileElement}74 * {@link io.appium.java_client.android.AndroidElement}75 */76 public static <T extends WebElement> EnhancedAndroidDriver<T> createAndroidDriver(AppiumDriverLocalService service, Capabilities desiredCapabilities) {77 WarnServiceAndBuilerNotSupportedInXTC();78 return provider.createAndroidDriver(service, desiredCapabilities);79 }80 /**81 * Create enhanced android driver, use in place of {@link io.appium.java_client.android.AndroidDriver#AndroidDriver(AppiumDriverLocalService, HttpClient.Factory, Capabilities)}82 * @param service local driver service. Warning: not supported in Xamarin test cloud.83 * @param httpClientFactory http client factory84 * @param desiredCapabilities desired capabilities for the session85 * @return enhanced Android driver86 * @param <T> the required type of class which implement {@link org.openqa.selenium.WebElement}.87 * Instances of the defined type will be returned via findElement* and findElements*.88 * Warning (!!!). Allowed types:89 * {@link org.openqa.selenium.WebElement}90 * {@link org.openqa.selenium.remote.RemoteWebElement}91 * {@link io.appium.java_client.MobileElement}92 * {@link io.appium.java_client.android.AndroidElement}93 */94 public static <T extends WebElement> EnhancedAndroidDriver<T> createAndroidDriver(AppiumDriverLocalService service, HttpClient.Factory httpClientFactory, Capabilities desiredCapabilities) {95 WarnServiceAndBuilerNotSupportedInXTC();96 return provider.createAndroidDriver(service, httpClientFactory, desiredCapabilities);97 }98 /**99 * Create enhanced android driver, use in place of {@link io.appium.java_client.android.AndroidDriver#AndroidDriver(AppiumServiceBuilder, Capabilities)}100 * @param builder service builder. Warning: not supported in Xamarin test cloud.101 * @param desiredCapabilities desired capabilities for the session102 * @param <T> the required type of class which implement {@link org.openqa.selenium.WebElement}.103 * Instances of the defined type will be returned via findElement* and findElements*.104 * Warning (!!!). Allowed types:105 * {@link org.openqa.selenium.WebElement}106 * {@link org.openqa.selenium.remote.RemoteWebElement}107 * {@link io.appium.java_client.MobileElement}108 * {@link io.appium.java_client.android.AndroidElement}109 * @return enhanced Android driver110 */111 public static <T extends WebElement> EnhancedAndroidDriver<T> createAndroidDriver(AppiumServiceBuilder builder, Capabilities desiredCapabilities) {112 WarnServiceAndBuilerNotSupportedInXTC();113 return provider.createAndroidDriver(builder, desiredCapabilities);114 }115 /**116 * Create enhanced android driver, use in place of {@link io.appium.java_client.android.AndroidDriver#AndroidDriver(AppiumDriverLocalService, HttpClient.Factory, Capabilities)}117 * @param builder service builder. Warning: not supported in Xamarin test cloud.118 * @param httpClientFactory http client factory119 * @param desiredCapabilities desired capabilities for the session120 * @param <T> the required type of class which implement {@link org.openqa.selenium.WebElement}.121 * Instances of the defined type will be returned via findElement* and findElements*.122 * Warning (!!!). Allowed types:123 * {@link org.openqa.selenium.WebElement}124 * {@link org.openqa.selenium.remote.RemoteWebElement}125 * {@link io.appium.java_client.MobileElement}126 * {@link io.appium.java_client.android.AndroidElement}127 * @return enhanced Android driver128 */129 public static <T extends WebElement> EnhancedAndroidDriver<T> createAndroidDriver(AppiumServiceBuilder builder, HttpClient.Factory httpClientFactory, Capabilities desiredCapabilities) {130 WarnServiceAndBuilerNotSupportedInXTC();131 return provider.createAndroidDriver(builder, httpClientFactory, desiredCapabilities);132 }133 /**134 * Create enhanced android driver, use in place of {@link io.appium.java_client.android.AndroidDriver#AndroidDriver(URL, Capabilities)}135 * @param httpClientFactory http client factory136 * @param desiredCapabilities desired capabilities for the session137 * @param <T> the required type of class which implement {@link org.openqa.selenium.WebElement}.138 * Instances of the defined type will be returned via findElement* and findElements*.139 * Warning (!!!). Allowed types:140 * {@link org.openqa.selenium.WebElement}141 * {@link org.openqa.selenium.remote.RemoteWebElement}142 * {@link io.appium.java_client.MobileElement}143 * {@link io.appium.java_client.android.AndroidElement}144 * @return enhanced Android driver145 */146 public static <T extends WebElement> EnhancedAndroidDriver<T> createAndroidDriver(HttpClient.Factory httpClientFactory, Capabilities desiredCapabilities) {147 return provider.createAndroidDriver(httpClientFactory, desiredCapabilities);148 }149 /**150 * Create enhanced android driver, use in place of {@link io.appium.java_client.android.AndroidDriver#AndroidDriver(URL, Capabilities)}151 * @param desiredCapabilities desired capabilities for the session152 * @param <T> the required type of class which implement {@link org.openqa.selenium.WebElement}.153 * Instances of the defined type will be returned via findElement* and findElements*.154 * Warning (!!!). Allowed types:155 * {@link org.openqa.selenium.WebElement}156 * {@link org.openqa.selenium.remote.RemoteWebElement}157 * {@link io.appium.java_client.MobileElement}158 * {@link io.appium.java_client.android.AndroidElement}159 * @return enhanced Android driver160 */161 public static <T extends WebElement> EnhancedAndroidDriver<T> createAndroidDriver(Capabilities desiredCapabilities) {162 return provider.createAndroidDriver(desiredCapabilities);163 }164 /**165 * Create enhanced iOS driver, use in place of {@link io.appium.java_client.ios.IOSDriver#IOSDriver(URL, HttpClient.Factory, Capabilities)}166 * @param url of the server167 * @param httpClientFactory http client factory168 * @param desiredCapabilities desired capabilities for the session169 * @param <T> the required type of class which implement {@link org.openqa.selenium.WebElement}.170 * Instances of the defined type will be returned via findElement* and findElements*.171 * Warning (!!!). Allowed types:172 * {@link org.openqa.selenium.WebElement}173 * {@link org.openqa.selenium.remote.RemoteWebElement}174 * {@link io.appium.java_client.MobileElement}175 * {@link io.appium.java_client.android.AndroidElement}176 * @return enhanced IOS driver177 */178 public static <T extends WebElement> EnhancedIOSDriver<T> createIOSDriver(URL url, HttpClient.Factory httpClientFactory, Capabilities desiredCapabilities) {179 return provider.createIOSDriver(url, httpClientFactory, desiredCapabilities);180 }181 /**182 * Create enhanced iOS driver, use in place of {@link io.appium.java_client.ios.IOSDriver#IOSDriver(AppiumDriverLocalService, Capabilities)}183 * @param service local driver service. Warning: not supported in Xamarin test cloud.184 * @param desiredCapabilities desired capabilities for the session185 * @return enhanced IOS driver186 * @param <T> the required type of class which implement {@link org.openqa.selenium.WebElement}.187 * Instances of the defined type will be returned via findElement* and findElements*.188 * Warning (!!!). Allowed types:189 * {@link org.openqa.selenium.WebElement}190 * {@link org.openqa.selenium.remote.RemoteWebElement}191 * {@link io.appium.java_client.MobileElement}192 * {@link io.appium.java_client.android.AndroidElement}193 */194 public static <T extends WebElement> EnhancedIOSDriver<T> createIOSDriver(AppiumDriverLocalService service, Capabilities desiredCapabilities) {195 WarnServiceAndBuilerNotSupportedInXTC();196 return provider.createIOSDriver(service, desiredCapabilities);197 }198 /**199 * Create enhanced iOS driver, use in place of {@link io.appium.java_client.ios.IOSDriver#IOSDriver(AppiumDriverLocalService, HttpClient.Factory, Capabilities)}200 * @param service local driver service. Warning: not supported in Xamarin test cloud.201 * @param httpClientFactory http client factory202 * @param desiredCapabilities desired capabilities for the session203 * @param <T> the required type of class which implement {@link org.openqa.selenium.WebElement}.204 * Instances of the defined type will be returned via findElement* and findElements*.205 * Warning (!!!). Allowed types:206 * {@link org.openqa.selenium.WebElement}207 * {@link org.openqa.selenium.remote.RemoteWebElement}208 * {@link io.appium.java_client.MobileElement}209 * {@link io.appium.java_client.android.AndroidElement}210 * @return enhanced IOS driver211 */212 public static <T extends WebElement> EnhancedIOSDriver<T> createIOSDriver(AppiumDriverLocalService service, HttpClient.Factory httpClientFactory, Capabilities desiredCapabilities) {213 WarnServiceAndBuilerNotSupportedInXTC();214 return provider.createIOSDriver(service, httpClientFactory, desiredCapabilities);215 }216 /**217 * Create enhanced iOS driver, use in place of {@link io.appium.java_client.ios.IOSDriver#IOSDriver(AppiumServiceBuilder, Capabilities)}218 * @param builder service builder. Warning: not supported in Xamarin test cloud.219 * @param desiredCapabilities desired capabilities for the session220 * @param <T> the required type of class which implement {@link org.openqa.selenium.WebElement}.221 * Instances of the defined type will be returned via findElement* and findElements*.222 * Warning (!!!). Allowed types:223 * {@link org.openqa.selenium.WebElement}224 * {@link org.openqa.selenium.remote.RemoteWebElement}225 * {@link io.appium.java_client.MobileElement}226 * {@link io.appium.java_client.android.AndroidElement}227 * @return enhanced IOS driver228 */229 public static <T extends WebElement> EnhancedIOSDriver<T> createIOSDriver(AppiumServiceBuilder builder, Capabilities desiredCapabilities) {230 WarnServiceAndBuilerNotSupportedInXTC();231 return provider.createIOSDriver(builder, desiredCapabilities);232 }233 /**234 * Create enhanced iOS driver, use in place of {@link io.appium.java_client.ios.IOSDriver#IOSDriver(AppiumDriverLocalService, HttpClient.Factory, Capabilities)}235 * @param builder service builder. Warning: not supported in Xamarin test cloud.236 * @param httpClientFactory http client factory237 * @param desiredCapabilities desired capabilities for the session238 * @param <T> the required type of class which implement {@link org.openqa.selenium.WebElement}.239 * Instances of the defined type will be returned via findElement* and findElements*.240 * Warning (!!!). Allowed types:241 * {@link org.openqa.selenium.WebElement}242 * {@link org.openqa.selenium.remote.RemoteWebElement}243 * {@link io.appium.java_client.MobileElement}244 * {@link io.appium.java_client.android.AndroidElement}245 * @return enhanced IOS driver246 */247 public static <T extends WebElement> EnhancedIOSDriver<T> createIOSDriver(AppiumServiceBuilder builder, HttpClient.Factory httpClientFactory, Capabilities desiredCapabilities) {248 WarnServiceAndBuilerNotSupportedInXTC();249 return provider.createIOSDriver(builder, httpClientFactory, desiredCapabilities);250 }251 /**252 * Create enhanced iOS driver, use in place of {@link io.appium.java_client.ios.IOSDriver#IOSDriver(URL, Capabilities)}253 * @param httpClientFactory http client factory254 * @param desiredCapabilities desired capabilities for the session255 * @param <T> the required type of class which implement {@link org.openqa.selenium.WebElement}.256 * Instances of the defined type will be returned via findElement* and findElements*.257 * Warning (!!!). Allowed types:258 * {@link org.openqa.selenium.WebElement}259 * {@link org.openqa.selenium.remote.RemoteWebElement}260 * {@link io.appium.java_client.MobileElement}261 * {@link io.appium.java_client.android.AndroidElement}262 * @return enhanced IOS driver263 */264 public static <T extends WebElement> EnhancedIOSDriver<T> createIOSDriver(HttpClient.Factory httpClientFactory, Capabilities desiredCapabilities) {265 return provider.createIOSDriver(httpClientFactory, desiredCapabilities);266 }267 /**268 * Create enhanced iOS driver, use in place of {@link io.appium.java_client.ios.IOSDriver#IOSDriver(URL, Capabilities)}269 * @param desiredCapabilities desired capabilities for the session270 * @param <T> the required type of class which implement {@link org.openqa.selenium.WebElement}.271 * Instances of the defined type will be returned via findElement* and findElements*.272 * Warning (!!!). Allowed types:273 * {@link org.openqa.selenium.WebElement}274 * {@link org.openqa.selenium.remote.RemoteWebElement}275 * {@link io.appium.java_client.MobileElement}276 * {@link io.appium.java_client.android.AndroidElement}277 * @return enhanced IOS driver278 */279 public static <T extends WebElement> EnhancedIOSDriver<T> createIOSDriver(Capabilities desiredCapabilities) {280 return provider.createIOSDriver(desiredCapabilities);281 }282 /**283 * Create enhanced iOS driver284 * @param url url of the server285 * @param capabilities desired capabilities for the session286 * @param <T> the required type of class which implement {@link org.openqa.selenium.WebElement}.287 * Instances of the defined type will be returned via findElement* and findElements*.288 * Warning (!!!). Allowed types:289 * {@link org.openqa.selenium.WebElement}290 * {@link org.openqa.selenium.remote.RemoteWebElement}291 * {@link io.appium.java_client.MobileElement}292 * {@link io.appium.java_client.android.AndroidElement}293 * @return enhanced iOS driver294 */295 public static <T extends WebElement> EnhancedIOSDriver<T> createIOSDriver(URL url, DesiredCapabilities capabilities) {296 return provider.createIOSDriver(url, capabilities);297 }298 /**299 * Create watcher for JUnit300 * @return a watcher for use with JUnit301 */...
Source:EyesAppiumElement.java
...81 }82 return wrappedElementsList;83 }84 @Override85 public List<WebElement> findElements(By by) {86 return wrapElements(webElement.findElements(by));87 }88 @Override89 public WebElement findElement(By by) {90 return wrapElement(webElement.findElement(by));91 }92 public WebElement findElementById(String using) {93 return wrapElement(webElement.findElement(By.id(using)));94 }95 public List<WebElement> findElementsById(String using) {96 return wrapElements(webElement.findElements(By.id(using)));97 }98 public WebElement findElementByLinkText(String using) {99 return wrapElement(webElement.findElement(By.linkText(using)));100 }101 public List<WebElement> findElementsByLinkText(String using) {102 return wrapElements(webElement.findElements(By.linkText(using)));103 }104 public WebElement findElementByName(String using) {105 return wrapElement(webElement.findElement(By.name(using)));106 }107 public List<WebElement> findElementsByName(String using) {108 return wrapElements(webElement.findElements(By.name(using)));109 }110 public WebElement findElementByClassName(String using) {111 return wrapElement(webElement.findElement(By.className(using)));112 }113 public List<WebElement> findElementsByClassName(String using) {114 return wrapElements(webElement.findElements(By.className(using)));115 }116 public WebElement findElementByCssSelector(String using) {117 return wrapElement(webElement.findElement(By.cssSelector(using)));118 }119 public List<WebElement> findElementsByCssSelector(String using) {120 return wrapElements(webElement.findElements(By.cssSelector(using)));121 }122 public WebElement findElementByXPath(String using) {123 return wrapElement(webElement.findElement(By.xpath(using)));124 }125 public List<WebElement> findElementsByXPath(String using) {126 return wrapElements(webElement.findElements(By.xpath(using)));127 }128 public WebElement findElementByPartialLinkText(String using) {129 return wrapElement(webElement.findElement(By.partialLinkText(using)));130 }131 public List<WebElement> findElementsByPartialLinkText(String using) {132 return wrapElements(webElement.findElements(By.partialLinkText(using)));133 }134 public WebElement findElementByTagName(String using) {135 return wrapElement(webElement.findElement(By.tagName(using)));136 }137 public List<WebElement> findElementsByTagName(String using) {138 return wrapElements(webElement.findElements(By.tagName(using)));139 }140 public boolean equals(Object obj) {141 return (obj instanceof RemoteWebElement) && webElement.equals(obj);142 }143 @Override144 public int hashCode() {145 return webElement.hashCode();146 }147 @Override148 public void setFileDetector(FileDetector detector) {149 webElement.setFileDetector(detector);150 }151 @Override152 public void submit() {...
Source:CalendarDynamicWebtableTwo.java
...41 cal_month=driver.findElement(By.xpath("//*[@id='ui-datepicker-div']/div[2]/div/div/span[1]")).getText();42}43 44 WebElement calendar= driver.findElement(By.xpath("//*[@id='ui-datepicker-div']/div[2]"));45 List<WebElement> rows= calendar.findElements(By.tagName("tr"));46 for(int i=0;i<rows.size();i++)47 {48 List<WebElement> cols = rows.get(i).findElements(By.tagName("td"));49 50 for(int j=0;j<cols.size();j++)51 {52 if(cols.get(j).getText().equals(day))53 54 {55 cols.get(j).click();56 break;57 }58 59 }60 61 62 }63 64 65 }66}67/*Exception in thread "main" org.openqa.selenium.StaleElementReferenceException: Element is no longer attached to the DOM68Command duration or timeout: 14 milliseconds69For documentation on this error, please visit: http://seleniumhq.org/exceptions/stale_element_reference.html70Build info: version: '2.50.1', revision: 'd7fc91b', time: '2016-01-29 19:08:26'71System info: host: 'VivekanandYG', ip: '192.168.1.2', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_60'72*** Element info: {Using=tag name, value=td}73Session ID: c4798855-5a27-4584-8433-8fc2ac06676374Driver info: org.openqa.selenium.firefox.FirefoxDriver75Capabilities [{platform=WINDOWS, acceptSslCerts=true, javascriptEnabled=true, cssSelectorsEnabled=true, databaseEnabled=true, browserName=firefox, handlesAlerts=true, nativeEvents=false, webStorageEnabled=true, rotatable=false, locationContextEnabled=true, applicationCacheEnabled=true, takesScreenshot=true, version=44.0.2}]76 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)77 at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)78 at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)79 at java.lang.reflect.Constructor.newInstance(Constructor.java:526)80 at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206)81 at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)82 at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:678)83 at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:327)84 at org.openqa.selenium.remote.RemoteWebElement.findElements(RemoteWebElement.java:214)85 at org.openqa.selenium.remote.RemoteWebElement.findElementsByTagName(RemoteWebElement.java:320)86 at org.openqa.selenium.By$ByTagName.findElements(By.java:327)87 at org.openqa.selenium.remote.RemoteWebElement.findElements(RemoteWebElement.java:190)88 at Package.WebTable.CalendarDynamicWebtableTwo.main(CalendarDynamicWebtableTwo.java:61)89Caused by: org.openqa.selenium.StaleElementReferenceException: Element is no longer attached to the DOM90For documentation on this error, please visit: http://seleniumhq.org/exceptions/stale_element_reference.html91Build info: version: '2.50.1', revision: 'd7fc91b', time: '2016-01-29 19:08:26'92System info: host: 'VivekanandYG', ip: '192.168.1.2', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_60'93Driver info: driver.version: unknown94 at <anonymous class>.fxdriver.cache.getElementAt(resource://fxdriver/modules/web-element-cache.js:9406)95 at <anonymous class>.Utils.getElementAt(file:///C:/Users/anand/AppData/Local/Temp/anonymous8141215110523029785webdriver-profile/extensions/fxdriver@googlecode.com/components/driver-component.js:8992)96 at <anonymous class>.FirefoxDriver.prototype.findElementsInternal_(file:///C:/Users/anand/AppData/Local/Temp/anonymous8141215110523029785webdriver-profile/extensions/fxdriver@googlecode.com/components/driver-component.js:10737)97 at <anonymous class>.FirefoxDriver.prototype.findChildElements(file:///C:/Users/anand/AppData/Local/Temp/anonymous8141215110523029785webdriver-profile/extensions/fxdriver@googlecode.com/components/driver-component.js:10758)98 at <anonymous class>.DelayedCommand.prototype.executeInternal_/h(file:///C:/Users/anand/AppData/Local/Temp/anonymous8141215110523029785webdriver-profile/extensions/fxdriver@googlecode.com/components/command-processor.js:12595)99 at <anonymous class>.DelayedCommand.prototype.executeInternal_(file:///C:/Users/anand/AppData/Local/Temp/anonymous8141215110523029785webdriver-profile/extensions/fxdriver@googlecode.com/components/command-processor.js:12600)100 at <anonymous class>.DelayedCommand.prototype.execute/<(file:///C:/Users/anand/AppData/Local/Temp/anonymous8141215110523029785webdriver-profile/extensions/fxdriver@googlecode.com/components/command-processor.js:12542)101*/...
Source:IosNativeDriver.java
...79 }80 @SuppressWarnings({"unchecked", "rawtypes"})81 public List<IosNativeElement> findIosNativeElements(82 org.openqa.selenium.By by) {83 return (List) findElements(by);84 }85 @Override86 public WebElement findElementByPlaceholder(String using) {87 return findElement(USING_PLACEHOLDER, using);88 }89 @Override90 public List<WebElement> findElementsByPlaceholder(String using) {91 return findElements(USING_PLACEHOLDER, using);92 }93 @Override94 public WebElement findElementByText(String using) {95 return findElement(USING_TEXT, using);96 }97 @Override98 public List<WebElement> findElementsByText(String using) {99 return findElements(USING_TEXT, using);100 }101 @Override102 public WebElement findElementByPartialText(String using) {103 return findElement(USING_PARTIALTEXT, using);104 }105 @Override106 public List<WebElement> findElementsByPartialText(String using) {107 return findElements(USING_PARTIALTEXT, using);108 }109}...
Source:ChromeDriverClient.java
...84 return null;85 }86 }87 88 public List<WebElement> findElements(By by) {89 return this.driver.findElements(by);90 }91 92 public String getpageSource() {93 return this.driver.getPageSource();94 }95 96 public boolean sendKeys(By by, String str) {97 WebElement element3 = findElement(by);98 if(element3 == null)99 return false;100 element3.sendKeys(str);101 return true;102 }103 ...
Source:MobileElement.java
...32public abstract class MobileElement extends RemoteWebElement implements FindsByAccessibilityId, TouchableElement {3334 protected FileDetector fileDetector;3536 public List<WebElement> findElements(By by) {37 return by.findElements(this);38 }3940 public WebElement findElement(By by) {41 return by.findElement(this);42 }4344 public WebElement findElementByAccessibilityId(String using) {45 return findElement("accessibility id", using);46 }4748 public List<WebElement> findElementsByAccessibilityId(String using) {49 return findElements("accessibility id", using);50 }5152 public void setValue(String value) {53 ImmutableMap.Builder builder = ImmutableMap.builder();54 builder.put("id", id).put("value", value);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 }63
...
findElements
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;8import java.util.List;9public class FindElements {10 public static void main(String[] args) {11 System.setProperty("webdriver.chrome.driver", "C:\\Users\\rakes\\Downloads\\chromedriver_win32\\chromedriver.exe");12 WebDriver driver = new ChromeDriver();13 RemoteWebElement remoteWebElement = (RemoteWebElement) element;14 System.out.println("No of elements in the dropdown are: " + elements.size());15 WebDriverWait wait = new WebDriverWait(driver, 10);16 wait.until(ExpectedConditions.elementToBeClickable(elements.get(1))).click();17 }18}19import org.openqa.selenium.By;20import org.openqa.selenium.WebDriver;21import org.openqa.selenium.WebElement;22import org.openqa.selenium.chrome.ChromeDriver;23import org.openqa.selenium.remote.RemoteWebElement;24import org.openqa.selenium.support.ui.ExpectedConditions;25import org.openqa.selenium.support.ui.WebDriverWait;26public class FindElement {27 public static void main(String[] args) {28 System.setProperty("webdriver.chrome.driver", "C:\\Users\\rakes\\Downloads\\chromedriver_win32\\chromedriver.exe");29 WebDriver driver = new ChromeDriver();30 RemoteWebElement remoteWebElement = (RemoteWebElement) element;
findElements
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 java.util.List;7public class FindElements {8 public static void main(String[] args) {9 System.setProperty("webdriver.chrome.driver", "C:\\Program Files\\selenium\\chromedriver.exe");10 WebDriver driver = new ChromeDriver();11 WebElement link = driver.findElement(By.id("www-wikipedia-org"));12 List<WebElement> elements = ((RemoteWebElement)link).findElements(By.cssSelector("*"));13 System.out.println(elements.size());14 driver.quit();15 }16}
findElements
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 java.util.List;6public class FindElements {7 public static void main(String[] args) {8 System.setProperty("webdriver.chrome.driver", "D:\\Selenium\\chromedriver.exe");9 WebDriver driver = new ChromeDriver();10 List<WebElement> elements = driver.findElements(By.tagName("a"));11 System.out.println("Number of elements:" + elements.size());12 for (int i=0; i<elements.size(); i++){13 System.out.println("Link Text:" + elements.get(i).getText());14 System.out.println("URL:" + elements.get(i).getAttribute("href"));15 }16 driver.quit();17 }18}
findElements
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 java.util.List;7public class FindElementsByCssSelector {8 public static void main(String[] args) {9 WebDriver driver = new ChromeDriver();10 WebElement element = driver.findElement(By.id("at-cv-lightbox-close"));11 element.click();12 WebElement element1 = driver.findElement(By.id("user-message"));13 element1.sendKeys("Hello World");14 WebElement element2 = driver.findElement(By.cssSelector("button[onclick='showInput();']"));15 element2.click();16 WebElement element3 = driver.findElement(By.cssSelector("button[onclick='return total()']"));17 element3.click();18 WebElement element4 = driver.findElement(By.cssSelector("span[id='displayvalue']"));19 String text = element4.getText();20 System.out.println(text);21 WebElement element5 = driver.findElement(By.cssSelector("input[id='sum1']"));22 element5.sendKeys("10");23 WebElement element6 = driver.findElement(By.cssSelector("input[id='sum2']"));24 element6.sendKeys("10");25 WebElement element7 = driver.findElement(By.cssSelector("button[onclick='return total()']"));26 element7.click();27 WebElement element8 = driver.findElement(By.cssSelector("span[id='displayvalue']"));28 String text1 = element8.getText();29 System.out.println(text1);30 WebElement element9 = driver.findElement(By.cssSelector("input[id='sum1']"));31 element9.clear();32 WebElement element10 = driver.findElement(By.cssSelector("input[id='sum2']"));33 element10.clear();34 WebElement element11 = driver.findElement(By.cssSelector("input[id='sum1']"));35 element11.sendKeys("20");36 WebElement element12 = driver.findElement(By.cssSelector("input[id='sum2']"));37 element12.sendKeys("20");38 WebElement element13 = driver.findElement(By.cssSelector("button[onclick='return total()']"));39 element13.click();40 WebElement element14 = driver.findElement(By.cssSelector("span[id='displayvalue']"));41 String text2 = element14.getText();
findElements
Using AI Code Generation
1import org.openqa.selenium.By;2import org.openqa.selenium.WebDriver;3import org.openqa.selenium.WebElement;4import org.openqa.selenium.firefox.FirefoxDriver;5import java.util.List;6public class FindElements {7 public static void main(String[] args) {8 WebDriver driver = new FirefoxDriver();9 List<WebElement> elements = driver.findElements(By.tagName("a"));10 System.out.println("Number of links: " + elements.size());11 for (WebElement e : elements) {12 System.out.println(e.getAttribute("href"));13 }14 driver.quit();15 }16}
findElements
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 java.util.List;6public class FindElements {7 public static void main(String[] args) throws InterruptedException {8 System.setProperty("webdriver.chrome.driver", "D:\\Selenium\\chromedriver.exe");9 WebDriver driver = new ChromeDriver();10 Thread.sleep(2000);11 driver.manage().window().maximize();12 for (WebElement element : elements) {13 System.out.println(element.getText());14 if (element.getText().contains("Brocolli - 1 Kg")) {15 element.findElement(By.xpath("div/button")).click();16 }17 }18 }19}
findElements
Using AI Code Generation
1package selenium;2import java.util.List;3import org.openqa.selenium.By;4import org.openqa.selenium.WebDriver;5import org.openqa.selenium.WebElement;6import org.openqa.selenium.chrome.ChromeDriver;7public class FindElements {8 public static void main(String[] args) {9 System.setProperty("webdriver.chrome.driver", "C:\\Users\\Karthik\\Downloads\\chromedriver_win32\\chromedriver.exe");10 WebDriver driver = new ChromeDriver();11 WebElement footerdriver = driver.findElement(By.id("navFooter"));12 System.out.println(footerdriver.findElements(By.tagName("a")).size());13 System.out.println(columndriver.findElements(By.tagName("a")).size());14 for(int i=0; i<columndriver.findElements(By.tagName("a")).size(); i++) {15 String clickonlinktab = Keys.chord(Keys.CONTROL,Keys.ENTER);16 columndriver.findElements(By.tagName("a")).get
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!!