Best Selenium code snippet using org.openqa.selenium.remote.RemoteWebElement.toString
Source:pureElement.java
...162 public pureElement findElement( Object by ){163 this.refresh(); // Method to detect, update and centre the object on screen if existing.164 Object SourceObject = this.pureElementMethodCall( "findElement", by );165 if ( SourceObject != null ) {166 pureCore.peMethod myMethod = pureCore.peMethodFromBy( by.toString() );167 pureElement newPureElement = new pureElement( "The Name", "The Type", myMethod.peMethodid, myMethod.peSearch, pureCore.defRefreshMode, this );168 newPureElement.theElement = SourceObject;169 newPureElement.refrehCode = "0xFFFFFFFF";170 return newPureElement;171 }else {172 return null;173 } 174 }175 // ************************************************************************************************************************ clear176 // WebElement [4] = public abstract java.util.List org.openqa.selenium.WebElement.findElements(org.openqa.selenium.By)177 // AndroidElement [16] = public java.util.List io.appium.java_client.MobileElement.findElements(org.openqa.selenium.By)178 // IOSElement [15] = public java.util.List io.appium.java_client.MobileElement.findElements(org.openqa.selenium.By)179 // MobileElement [4] = public org.openqa.selenium.WebElement io.appium.java_client.MobileElement.findElement(org.openqa.selenium.By)180 public pureElements findElements( Object by ){181 this.refresh(); // Method to detect, update and centre the object on screen if existing.182 Object feedback = this.pureElementMethodCall( "findElements", by );183 List<Object> myObjectList = pureCore.CastObjecttoList( feedback );184 if ( myObjectList != null ) {185 pureCore.peMethod myMethod = pureCore.peMethodFromBy( by.toString() );186 pureElements newPureElements = new pureElements( "-", "-", myMethod.peMethodid, myMethod.peSearch, pureCore.defRefreshMode, this );187 newPureElements.theElements = myObjectList;188 newPureElements.refrehCode = "0xFFFFFFFF";189 return newPureElements;190 }else {191 return null;192 }193 }194 195 // ************************************************************************************************************************ clear196 // WebElement [5] = public abstract void org.openqa.selenium.WebElement.click()197 // AndroidElement [38] = public void org.openqa.selenium.remote.RemoteWebElement.click()198 // IOSElement [37] = public void org.openqa.selenium.remote.RemoteWebElement.click()199 // MobileElement [37] = public void org.openqa.selenium.remote.RemoteWebElement.click()200 public void click() {201 this.refresh(); // Method to detect, update and centre the object on screen if existing.202 // this.centerOnScreen(); // Method to put object in center of the screen if partially or not visible203 this.pureElementMethodCall( "click" );204 }205 206 // ************************************************************************************************************************ clear207 // WebElement [6] = public abstract void org.openqa.selenium.WebElement.sendKeys(java.lang.CharSequence[])208 // AndroidElement [39] = public void org.openqa.selenium.remote.RemoteWebElement.sendKeys(java.lang.CharSequence[])209 // IOSElement [38] = public void org.openqa.selenium.remote.RemoteWebElement.sendKeys(java.lang.CharSequence[])210 // MobileElement [38] = public void org.openqa.selenium.remote.RemoteWebElement.sendKeys(java.lang.CharSequence[])211 public void sendKeys( String charSequence ) {212 this.refresh(); // Method to detect, update and centre the object on screen if existing.213 this.centerOnScreen(); // Method to put object in center of the screen if partially or not visible214 pureDriverDetails myDriver = pureDrivers.getCurrentDriverDetails();215 java.lang.CharSequence mySequency[] = new java.lang.CharSequence[ charSequence.length() ];216 for( int iLoop = 0; iLoop < charSequence.length(); iLoop++ ) {217 mySequency[ iLoop ] = charSequence.substring( iLoop, iLoop +1 );218 }219 pureCore.callMethod( this.theElement, myDriver.elementClass, "sendKeys", java.lang.CharSequence[].class, "pureElement.sendKeys", mySequency );220 }221 // ************************************************************************************************************************ clear222 // WebElement [7] = public abstract void org.openqa.selenium.WebElement.submit()223 // AndroidElement [12] = public void io.appium.java_client.android.AndroidElement.submit() throws org.openqa.selenium.WebDriverException224 // IOSElement [12] = public void io.appium.java_client.ios.IOSElement.submit() throws org.openqa.selenium.WebDriverException225 // MobileElement [23] = public void io.appium.java_client.MobileElement.submit() throws org.openqa.selenium.WebDriverException226 public void submit() {227 this.refresh(); // Method to detect, update and centre the object on screen if existing.228 this.centerOnScreen(); // Method to put object in center of the screen if partially or not visible229 this.pureElementMethodCall( "submit" );230 }231 232 // ************************************************************************************************************************ clear233 // WebElement [8] = public abstract java.lang.String org.openqa.selenium.WebElement.getTagName()234 // AndroidElement [40] = public java.lang.String org.openqa.selenium.remote.RemoteWebElement.getTagName()235 // IOSElement [39] = public java.lang.String org.openqa.selenium.remote.RemoteWebElement.getTagName()236 // MobileElement [39] = public java.lang.String org.openqa.selenium.remote.RemoteWebElement.getTagName()237 public String getTagName() {238 this.refresh(); // Method to detect, update and centre the object on screen if existing.239 return (String)this.pureElementMethodCall( "getTagName" );240 }241 242 // ************************************************************************************************************************ clear243 // WebElement [9] = public abstract java.lang.String org.openqa.selenium.WebElement.getAttribute(java.lang.String)244 // AndroidElement [41] = public java.lang.String org.openqa.selenium.remote.RemoteWebElement.getAttribute(java.lang.String)245 // IOSElement [40] = public java.lang.String org.openqa.selenium.remote.RemoteWebElement.getAttribute(java.lang.String)246 // MobileElement [40] = public java.lang.String org.openqa.selenium.remote.RemoteWebElement.getAttribute(java.lang.String)247 public String getAttribute( String AttributeName ) {248 this.refresh(); // Method to detect, update and centre the object on screen if existing.249 return (String)this.pureElementMethodCall( "getAttribute", (Object)AttributeName );250 }251 252 // ************************************************************************************************************************ clear253 // WebElement [10] = public abstract boolean org.openqa.selenium.WebElement.isSelected()254 // AndroidElement [42] = public boolean org.openqa.selenium.remote.RemoteWebElement.isSelected()255 // IOSElement [41] = public boolean org.openqa.selenium.remote.RemoteWebElement.isSelected()256 // MobileElement [41] = public boolean org.openqa.selenium.remote.RemoteWebElement.isSelected()257 public boolean isSelected() {258 this.refresh();259 return (boolean)this.pureElementMethodCall( "isSelected" );260 }261 262 // ************************************************************************************************************************ clear263 // WebElement [11] = public abstract boolean org.openqa.selenium.WebElement.isEnabled()264 // AndroidElement [43] = public boolean org.openqa.selenium.remote.RemoteWebElement.isEnabled()265 // IOSElement [42] = public boolean org.openqa.selenium.remote.RemoteWebElement.isEnabled()266 // MobileElement [42] = public boolean org.openqa.selenium.remote.RemoteWebElement.isEnabled()267 public boolean isEnabled() {268 this.refresh();269 return (boolean)this.pureElementMethodCall( "isEnabled" );270 }271 272 // ************************************************************************************************************************ clear273 // WebElement [12] = public abstract java.lang.String org.openqa.selenium.WebElement.getText()274 // AndroidElement [44] = public java.lang.String org.openqa.selenium.remote.RemoteWebElement.getText()275 // IOSElement [43] = public java.lang.String org.openqa.selenium.remote.RemoteWebElement.getText()276 // MobileElement [43] = public java.lang.String org.openqa.selenium.remote.RemoteWebElement.getText()277 public String getText() {278 this.refresh();279 return (String)this.pureElementMethodCall( "getText" );280 }281 282 // ************************************************************************************************************************ clear283 // WebElement [13] = public abstract boolean org.openqa.selenium.WebElement.isDisplayed()284 // AndroidElement [45] = public boolean org.openqa.selenium.remote.RemoteWebElement.isDisplayed()285 // IOSElement [44] = public boolean org.openqa.selenium.remote.RemoteWebElement.isDisplayed()286 // MobileElement [44] = public boolean org.openqa.selenium.remote.RemoteWebElement.isDisplayed()287 public boolean isDisplayed() {288 this.refresh();289 return (boolean)this.pureElementMethodCall( "isDisplayed" );290 }291 // ************************************************************************************************************************ clear292 // WebElement [14] = public abstract org.openqa.selenium.Rectangle org.openqa.selenium.WebElement.getRect()293 // AndroidElement [46] = public org.openqa.selenium.Rectangle org.openqa.selenium.remote.RemoteWebElement.getRect()294 // IOSElement [45] = public org.openqa.selenium.Rectangle org.openqa.selenium.remote.RemoteWebElement.getRect()295 // MobileElement [45] = public org.openqa.selenium.Rectangle org.openqa.selenium.remote.RemoteWebElement.getRect()296 public org.openqa.selenium.Rectangle getRect() {297 this.refresh();298 return (org.openqa.selenium.Rectangle)this.pureElementMethodCall( "getRect" );299 }300 // ************************************************************************************************************************ clear301 // WebElement [15] = public abstract java.lang.String org.openqa.selenium.WebElement.getCssValue(java.lang.String)302 // AndroidElement [13] = public java.lang.String io.appium.java_client.android.AndroidElement.getCssValue(java.lang.String) throws org.openqa.selenium.WebDriverException303 // IOSElement [13] = public java.lang.String io.appium.java_client.ios.IOSElement.getCssValue(java.lang.String) throws org.openqa.selenium.WebDriverException304 // MobileElement [24] = public java.lang.String io.appium.java_client.MobileElement.getCssValue(java.lang.String) throws org.openqa.selenium.WebDriverException305 public String getCssValue( String cssValue ) {306 this.refresh();307 return (String)this.pureElementMethodCall( "getCssValue", (Object) cssValue );308 }309 // ************************************************************************************************************************ clear310 // WebElement [16] = public abstract java.lang.Object org.openqa.selenium.TakesScreenshot.getScreenshotAs(org.openqa.selenium.OutputType) throws org.openqa.selenium.WebDriverException311 // AndroidElement [37] = public java.lang.Object org.openqa.selenium.remote.RemoteWebElement.getScreenshotAs(org.openqa.selenium.OutputType) throws org.openqa.selenium.WebDriverException312 // IOSElement [36] = public java.lang.Object org.openqa.selenium.remote.RemoteWebElement.getScreenshotAs(org.openqa.selenium.OutputType) throws org.openqa.selenium.WebDriverException313 // MobileElement [36] = public java.lang.Object org.openqa.selenium.remote.RemoteWebElement.getScreenshotAs(org.openqa.selenium.OutputType) throws org.openqa.selenium.WebDriverException314 public Object getScreenshotAs( org.openqa.selenium.OutputType<?> outputType ) {315 this.refresh();316 this.centerOnScreen(); // Method to put object in center of the screen if partially or not visible317 return this.pureElementMethodCall( "getScreenshotAs", (Object) outputType );318 }319 // ************************************************************************************************************************ 320 // AndroidElement [0] = public org.openqa.selenium.remote.Response io.appium.java_client.android.AndroidElement.execute(java.lang.String,java.util.Map)321 // IOSElement [0] = public org.openqa.selenium.remote.Response io.appium.java_client.ios.IOSElement.execute(java.lang.String,java.util.Map)322 // MobileElement [1] = public org.openqa.selenium.remote.Response io.appium.java_client.MobileElement.execute(java.lang.String,java.util.Map)323 public org.openqa.selenium.remote.Response execute( java.lang.String execute, java.util.Map<?,?> map ){324 this.refresh();325 this.centerOnScreen(); // Method to put object in center of the screen if partially or not visible326 pureDriverDetails myDriver = pureDrivers.getCurrentDriverDetails();327 //328 Class<?>[] myClasses = new Class[2];329 myClasses[ 0 ] = java.lang.String.class;330 myClasses[ 1 ] = java.util.Map.class;331 //332 Object[] myTrueParam = new Object[2];333 myTrueParam[ 0 ] = (Object)execute;334 myTrueParam[ 1 ] = (Object)map;335 //336 return (org.openqa.selenium.remote.Response)pureCore.callMethod(337 this.theElement, myDriver.elementClass, "execute", myClasses, "pureElement.execute", myTrueParam );338 }339 // ************************************************************************************************************************ 340 // AndroidElement [1] = public org.openqa.selenium.remote.Response io.appium.java_client.android.AndroidElement.execute(java.lang.String)341 // IOSElement [1] = public org.openqa.selenium.remote.Response io.appium.java_client.ios.IOSElement.execute(java.lang.String)342 // MobileElement [0] = public org.openqa.selenium.remote.Response io.appium.java_client.MobileElement.execute(java.lang.String)343 public org.openqa.selenium.remote.Response execute( java.lang.String execute ){344 this.refresh();345 this.centerOnScreen(); // Method to put object in center of the screen if partially or not visible346 pureDriverDetails myDriver = pureDrivers.getCurrentDriverDetails();347 return (org.openqa.selenium.remote.Response)pureCore.callMethod(348 this.theElement, myDriver.elementClass, "execute", java.lang.String.class, "pureElement.execute", execute );349 }350 351 // ************************************************************************************************************************ 352 // AndroidElement [3] = public org.openqa.selenium.WebElement io.appium.java_client.android.AndroidElement.findElement(java.lang.String,java.lang.String)353 // IOSElement [2] = public org.openqa.selenium.WebElement io.appium.java_client.ios.IOSElement.findElement(java.lang.String,java.lang.String)354 // MobileElement [3] = public org.openqa.selenium.WebElement io.appium.java_client.MobileElement.findElement(java.lang.String,java.lang.String)355 public pureElement findElement( String method, String path ){356 this.refresh(); // Method to detect, update and centre the object on screen if existing.357 pureDriverDetails myDriver = pureDrivers.getCurrentDriverDetails();358 //359 Class<?>[] myClasses = new Class[2];360 myClasses[ 0 ] = java.lang.String.class;361 myClasses[ 1 ] = java.lang.String.class;362 //363 Object[] myTrueParam = new Object[2];364 myTrueParam[ 0 ] = (Object)method;365 myTrueParam[ 1 ] = (Object)path;366 //367 Object SourceObject = (Object)pureCore.callMethod( this.theElement, myDriver.elementClass, "findElement", myClasses, "pureElement.findElement", myTrueParam );368 if ( SourceObject != null ) {369 int elemMethod = pureCore.MethodFromStringLocator( method );370 pureElement newPureElement = new pureElement( "The Name", "The Type", elemMethod, path, pureCore.defRefreshMode, this );371 newPureElement.theElement = SourceObject;372 newPureElement.refrehCode = "0xFFFFFFFF";373 return newPureElement;374 }else {375 return null;376 } 377 }378 379 // ************************************************************************************************************************ 380 // Internal optimisation for following findElement methods.381 private pureElement intFindElementXXX( String MethodName, int elementMethod, String Description ) {382 this.refresh();383 Object SourceObject = (Object) this.pureElementMethodCall( MethodName, (Object)Description );384 if ( SourceObject != null ) {385 pureElement newPureElement = new pureElement( "The Name", "The Type", elementMethod, Description, pureCore.defRefreshMode, this );386 newPureElement.theElement = SourceObject;387 newPureElement.refrehCode = "0xFFFFFFFF";388 return newPureElement;389 }else {390 return (pureElement)null;391 } 392 } 393 394 // ************************************************************************************************************************ 395 // AndroidElement [4] = public org.openqa.selenium.WebElement io.appium.java_client.android.AndroidElement.findElementByLinkText(java.lang.String) throws org.openqa.selenium.WebDriverException396 // IOSElement [4] = public org.openqa.selenium.WebElement io.appium.java_client.ios.IOSElement.findElementByLinkText(java.lang.String) throws org.openqa.selenium.WebDriverException397 // MobileElement [7] = public org.openqa.selenium.WebElement io.appium.java_client.MobileElement.findElementByLinkText(java.lang.String) throws org.openqa.selenium.WebDriverException398 public pureElement findElementByLinkText( String Description ){399 return this.intFindElementXXX( "findElementByLinkText", pureCore.elementMethod.linkText, Description );400 }401 // ************************************************************************************************************************ 402 // AndroidElement [5] = public org.openqa.selenium.WebElement io.appium.java_client.android.AndroidElement.findElementByPartialLinkText(java.lang.String) throws org.openqa.selenium.WebDriverException403 // IOSElement [5] = public org.openqa.selenium.WebElement io.appium.java_client.ios.IOSElement.findElementByPartialLinkText(java.lang.String) throws org.openqa.selenium.WebDriverException404 // MobileElement [8] = public org.openqa.selenium.WebElement io.appium.java_client.MobileElement.findElementByPartialLinkText(java.lang.String) throws org.openqa.selenium.WebDriverException405 public pureElement findElementByPartialLinkText( String Description ){406 return this.intFindElementXXX( "findElementByPartialLinkText", pureCore.elementMethod.partialLinkText, Description );407 }408 409 // ************************************************************************************************************************ 410 // AndroidElement [6] = public org.openqa.selenium.WebElement io.appium.java_client.android.AndroidElement.findElementByTagName(java.lang.String)411 // IOSElement [6] = public org.openqa.selenium.WebElement io.appium.java_client.ios.IOSElement.findElementByTagName(java.lang.String)412 // MobileElement [9] = public org.openqa.selenium.WebElement io.appium.java_client.MobileElement.findElementByTagName(java.lang.String)413 public pureElement findElementByTagName( String Description ){414 return this.intFindElementXXX( "findElementByTagName", pureCore.elementMethod.tagNamei, Description );415 }416 417 // ************************************************************************************************************************ 418 // AndroidElement [7] = public org.openqa.selenium.WebElement io.appium.java_client.android.AndroidElement.findElementByName(java.lang.String)419 // IOSElement [7] = public org.openqa.selenium.WebElement io.appium.java_client.ios.IOSElement.findElementByName(java.lang.String)420 // MobileElement [10] = public org.openqa.selenium.WebElement io.appium.java_client.MobileElement.findElementByName(java.lang.String)421 public pureElement findElementByName( String Description ){422 return this.intFindElementXXX( "findElementByName", pureCore.elementMethod.name, Description );423 }424 425 // ************************************************************************************************************************ 426 // AndroidElement [8] = public org.openqa.selenium.WebElement io.appium.java_client.android.AndroidElement.findElementByClassName(java.lang.String)427 // IOSElement [8] = public org.openqa.selenium.WebElement io.appium.java_client.ios.IOSElement.findElementByClassName(java.lang.String)428 // MobileElement [11] = public org.openqa.selenium.WebElement io.appium.java_client.MobileElement.findElementByClassName(java.lang.String)429 public pureElement findElementByClassName( String Description ){430 return this.intFindElementXXX( "findElementByClassName", pureCore.elementMethod.className, Description );431 }432 433 // ************************************************************************************************************************ 434 // AndroidElement [9] = public org.openqa.selenium.WebElement io.appium.java_client.android.AndroidElement.findElementByCssSelector(java.lang.String) throws org.openqa.selenium.WebDriverException435 // IOSElement [9] = public org.openqa.selenium.WebElement io.appium.java_client.ios.IOSElement.findElementByCssSelector(java.lang.String) throws org.openqa.selenium.WebDriverException436 // MobileElement [12] = public org.openqa.selenium.WebElement io.appium.java_client.MobileElement.findElementByCssSelector(java.lang.String) throws org.openqa.selenium.WebDriverException437 public pureElement findElementByCssSelector( String Description ){438 return this.intFindElementXXX( "findElementByCssSelector", pureCore.elementMethod.cssSelector, Description );439 }440 441 // ************************************************************************************************************************ 442 // AndroidElement [10] = public org.openqa.selenium.WebElement io.appium.java_client.android.AndroidElement.findElementByXPath(java.lang.String)443 // IOSElement [10] = public org.openqa.selenium.WebElement io.appium.java_client.ios.IOSElement.findElementByXPath(java.lang.String)444 // MobileElement [13] = public org.openqa.selenium.WebElement io.appium.java_client.MobileElement.findElementByXPath(java.lang.String)445 public pureElement findElementByXPath( String Description ){446 return this.intFindElementXXX( "findElementByXPath", pureCore.elementMethod.xpath, Description );447 }448 449 // ************************************************************************************************************************ 450 // AndroidElement [11] = public org.openqa.selenium.WebElement io.appium.java_client.android.AndroidElement.findElementById(java.lang.String)451 // IOSElement [11] = public org.openqa.selenium.WebElement io.appium.java_client.ios.IOSElement.findElementById(java.lang.String)452 // MobileElement [21] = public org.openqa.selenium.WebElement io.appium.java_client.MobileElement.findElementById(java.lang.String)453 public pureElement findElementById( String Description ){454 return this.intFindElementXXX( "findElementById", pureCore.elementMethod.id, Description );455 }456 457 // ************************************************************************************************************************ 458 // AndroidElement [14] = public void io.appium.java_client.android.AndroidElement.replaceValue(java.lang.String)459 public void replaceValue( java.lang.String value ) {460 this.refresh();461 this.centerOnScreen(); // Method to put object in center of the screen if partially or not visible462 this.pureElementMethodCall( "replaceValue", (Object)value );463 }464 465 // ************************************************************************************************************************ 466 // AndroidElement [15] = public void io.appium.java_client.MobileElement.setValue(java.lang.String)467 // IOSElement [14] = public void io.appium.java_client.MobileElement.setValue(java.lang.String)468 // MobileElement [2] = public void io.appium.java_client.MobileElement.setValue(java.lang.String)469 public void setValue( java.lang.String value ) {470 this.refresh();471 this.centerOnScreen(); // Method to put object in center of the screen if partially or not visible472 this.pureElementMethodCall( "setValue", (Object)value );473 }474 // ************************************************************************************************************************ 475 // AndroidElement [17] = public java.util.List io.appium.java_client.MobileElement.findElements(java.lang.String,java.lang.String)476 // IOSElement [16] = public java.util.List io.appium.java_client.MobileElement.findElements(java.lang.String,java.lang.String)477 // MobileElement [6] = public java.util.List io.appium.java_client.MobileElement.findElements(java.lang.String,java.lang.String)478 479 // ************************************************************************************************************************ 480 // Internal optimisation for the following findElementsXXX methods481 private pureElements intFindElementsXXX( String MethodName, int elementMethod, String Description ) {482 this.refresh(); // Method to detect, update and centre the object on screen if existing.483 Object feedback = this.pureElementMethodCall( MethodName, (Object)Description );484 List<Object> myObjectList = pureCore.CastObjecttoList( feedback );485 if ( myObjectList != null ) {486 pureElements newPureElements = new pureElements( "-", "-", elementMethod, Description, pureCore.defRefreshMode, this );487 newPureElements.theElements = myObjectList;488 newPureElements.refrehCode = "0xFFFFFFFF";489 return newPureElements;490 }else {491 return null;492 }493 }494 // ************************************************************************************************************************ 495 // AndroidElement [18] = public java.util.List io.appium.java_client.MobileElement.findElementsByLinkText(java.lang.String)496 // IOSElement [17] = public java.util.List io.appium.java_client.MobileElement.findElementsByLinkText(java.lang.String)497 // MobileElement [14] = public java.util.List io.appium.java_client.MobileElement.findElementsByLinkText(java.lang.String)498 public pureElements findElementsByLinkText( java.lang.String Description ){499 return intFindElementsXXX( "findElementsByLinkText", pureCore.elementMethod.linkText, Description );500 }501 // ************************************************************************************************************************ 502 // AndroidElement [19] = public java.util.List io.appium.java_client.MobileElement.findElementsByPartialLinkText(java.lang.String)503 // IOSElement [18] = public java.util.List io.appium.java_client.MobileElement.findElementsByPartialLinkText(java.lang.String)504 // MobileElement [15] = public java.util.List io.appium.java_client.MobileElement.findElementsByPartialLinkText(java.lang.String)505 public pureElements findElementsByPartialLinkText( java.lang.String Description ){506 return intFindElementsXXX( "findElementsByPartialLinkText", pureCore.elementMethod.partialLinkText, Description );507 }508 509 // ************************************************************************************************************************ 510 // AndroidElement [20] = public java.util.List io.appium.java_client.MobileElement.findElementsByTagName(java.lang.String)511 // IOSElement [19] = public java.util.List io.appium.java_client.MobileElement.findElementsByTagName(java.lang.String)512 // MobileElement [16] = public java.util.List io.appium.java_client.MobileElement.findElementsByTagName(java.lang.String)513 public pureElements findElementsByTagName( java.lang.String Description ){514 return intFindElementsXXX( "findElementsByTagName", pureCore.elementMethod.tagNamei, Description );515 }516 517 // ************************************************************************************************************************ 518 // AndroidElement [21] = public java.util.List io.appium.java_client.MobileElement.findElementsByName(java.lang.String)519 // IOSElement [20] = public java.util.List io.appium.java_client.MobileElement.findElementsByName(java.lang.String)520 // MobileElement [17] = public java.util.List io.appium.java_client.MobileElement.findElementsByName(java.lang.String)521 public pureElements findElementsByName( java.lang.String Description ){522 return intFindElementsXXX( "findElementsByName", pureCore.elementMethod.name, Description );523 }524 525 // ************************************************************************************************************************ 526 // AndroidElement [22] = public java.util.List io.appium.java_client.MobileElement.findElementsByClassName(java.lang.String)527 // IOSElement [21] = public java.util.List io.appium.java_client.MobileElement.findElementsByClassName(java.lang.String)528 // MobileElement [18] = public java.util.List io.appium.java_client.MobileElement.findElementsByClassName(java.lang.String)529 public pureElements findElementsByClassName( java.lang.String Description ){530 return intFindElementsXXX( "findElementsByClassName", pureCore.elementMethod.className, Description );531 }532 533 // ************************************************************************************************************************ 534 // AndroidElement [23] = public java.util.List io.appium.java_client.MobileElement.findElementsByCssSelector(java.lang.String)535 // IOSElement [22] = public java.util.List io.appium.java_client.MobileElement.findElementsByCssSelector(java.lang.String)536 // MobileElement [19] = public java.util.List io.appium.java_client.MobileElement.findElementsByCssSelector(java.lang.String)537 public pureElements findElementsByCssSelector( java.lang.String Description ){538 return intFindElementsXXX( "findElementsByCssSelector", pureCore.elementMethod.cssSelector, Description );539 }540 541 // ************************************************************************************************************************ 542 // AndroidElement [24] = public java.util.List io.appium.java_client.MobileElement.findElementsByXPath(java.lang.String)543 // IOSElement [23] = public java.util.List io.appium.java_client.MobileElement.findElementsByXPath(java.lang.String)544 // MobileElement [20] = public java.util.List io.appium.java_client.MobileElement.findElementsByXPath(java.lang.String)545 public pureElements findElementsByXPath( java.lang.String Description ){546 return intFindElementsXXX( "findElementsByXPath", pureCore.elementMethod.xpath, Description );547 }548 549 // ************************************************************************************************************************ 550 // AndroidElement [25] = public java.util.List io.appium.java_client.MobileElement.findElementsById(java.lang.String)551 // IOSElement [24] = public java.util.List io.appium.java_client.MobileElement.findElementsById(java.lang.String)552 // MobileElement [22] = public java.util.List io.appium.java_client.MobileElement.findElementsById(java.lang.String)553 public pureElements findElementsById( java.lang.String Description ){554 return intFindElementsXXX( "findElementsById", pureCore.elementMethod.id, Description );555 }556 557 // ************************************************************************************************************************ 558 // AndroidElement [26] = public java.util.List io.appium.java_client.MobileElement.findElementsByAccessibilityId(java.lang.String)559 // IOSElement [25] = public java.util.List io.appium.java_client.MobileElement.findElementsByAccessibilityId(java.lang.String)560 // MobileElement [26] = public java.util.List io.appium.java_client.MobileElement.findElementsByAccessibilityId(java.lang.String)561 public pureElements findElementsByAccessibilityId( java.lang.String Description ){562 return intFindElementsXXX( "findElementsByAccessibilityId", pureCore.elementMethod.AccessibilityId, Description );563 }564 565 // ************************************************************************************************************************ 566 // AndroidElement [27] = public org.openqa.selenium.Point io.appium.java_client.MobileElement.getCenter()567 // IOSElement [26] = public org.openqa.selenium.Point io.appium.java_client.MobileElement.getCenter()568 // MobileElement [25] = public org.openqa.selenium.Point io.appium.java_client.MobileElement.getCenter()569 public org.openqa.selenium.Point getCenter(){570 this.refresh();571 return (org.openqa.selenium.Point)this.pureElementMethodCall( "getCenter" );572 }573 // ************************************************************************************************************************ 574 // AndroidElement [28] = public boolean org.openqa.selenium.remote.RemoteWebElement.equals(java.lang.Object)575 // IOSElement [27] = public boolean org.openqa.selenium.remote.RemoteWebElement.equals(java.lang.Object)576 // MobileElement [27] = public boolean org.openqa.selenium.remote.RemoteWebElement.equals(java.lang.Object)577 public boolean equalsL( Object equalsto ){578 this.refresh();579 return (boolean)this.pureElementMethodCall( "equals", equalsto );580 }581 582 // ************************************************************************************************************************ 583 // AndroidElement [29] = public java.lang.String org.openqa.selenium.remote.RemoteWebElement.toString()584 // IOSElement [28] = public java.lang.String org.openqa.selenium.remote.RemoteWebElement.toString()585 // MobileElement [28] = public java.lang.String org.openqa.selenium.remote.RemoteWebElement.toString()586 public java.lang.String toStringL(){587 this.refresh();588 return (String)this.pureElementMethodCall( "toString" );589 }590 591 // ************************************************************************************************************************ 592 // AndroidElement [30] = public int org.openqa.selenium.remote.RemoteWebElement.hashCode()593 // IOSElement [29] = public int org.openqa.selenium.remote.RemoteWebElement.hashCode()594 // MobileElement [29] = public int org.openqa.selenium.remote.RemoteWebElement.hashCode()595 public int hashCodeL(){596 this.refresh();597 return (int)this.pureElementMethodCall( "hashCode" );598 }599 600 // ************************************************************************************************************************ 601 // AndroidElement [33] = public java.lang.String org.openqa.selenium.remote.RemoteWebElement.getId()602 // IOSElement [32] = public java.lang.String org.openqa.selenium.remote.RemoteWebElement.getId()603 // MobileElement [32] = public java.lang.String org.openqa.selenium.remote.RemoteWebElement.getId()604 public java.lang.String getId(){605 this.refresh();606 return (java.lang.String)this.pureElementMethodCall( "getId" );607 }608 // ************************************************************************************************************************ 609 // AndroidElement [35] = public void org.openqa.selenium.remote.RemoteWebElement.setParent(org.openqa.selenium.remote.RemoteWebDriver)610 // IOSElement [34] = public void org.openqa.selenium.remote.RemoteWebElement.setParent(org.openqa.selenium.remote.RemoteWebDriver)611 // MobileElement [34] = public void org.openqa.selenium.remote.RemoteWebElement.setParent(org.openqa.selenium.remote.RemoteWebDriver)612 public void setParent( org.openqa.selenium.remote.RemoteWebDriver remoteWebDriver ){613 this.refresh();614 this.pureElementMethodCall( "setParent", remoteWebDriver );615 }616 // ************************************************************************************************************************ 617 // AndroidElement [36] = public void org.openqa.selenium.remote.RemoteWebElement.setFileDetector(org.openqa.selenium.remote.FileDetector)618 // IOSElement [35] = public void org.openqa.selenium.remote.RemoteWebElement.setFileDetector(org.openqa.selenium.remote.FileDetector)619 // MobileElement [35] = public void org.openqa.selenium.remote.RemoteWebElement.setFileDetector(org.openqa.selenium.remote.FileDetector)620 public void setFileDetector( org.openqa.selenium.remote.FileDetector fileSelector ) {621 this.refresh();622 this.pureElementMethodCall( "setFileDetector", fileSelector );623 }624 625 // ************************************************************************************************************************ 626 // AndroidElement [47] = public org.openqa.selenium.WebDriver org.openqa.selenium.remote.RemoteWebElement.getWrappedDriver()627 // IOSElement [48] = public org.openqa.selenium.WebDriver org.openqa.selenium.remote.RemoteWebElement.getWrappedDriver()628 // MobileElement [46] = public org.openqa.selenium.WebDriver org.openqa.selenium.remote.RemoteWebElement.getWrappedDriver()629/* public pureDrivers getWrappedDriver(){630 this.refresh();631 Object SourceObject = this.pureElementMethodCall( "getWrappedDriver" );632 if ( SourceObject != null ) {633 pureDrivers newDriver = new pureDrivers();634 newDriver.DriverName = "WrappedDriver";635 newDriver.subDriverName = "";636 newDriver.mainDriver = SourceObject;637 return newDriver;638 }else {639 return null;640 }641 } */642 643 // ************************************************************************************************************************ 644 // AndroidElement [48] = public org.openqa.selenium.interactions.internal.Coordinates org.openqa.selenium.remote.RemoteWebElement.getCoordinates()645 // IOSElement [49] = public org.openqa.selenium.interactions.internal.Coordinates org.openqa.selenium.remote.RemoteWebElement.getCoordinates()646 // MobileElement [47] = public org.openqa.selenium.interactions.internal.Coordinates org.openqa.selenium.remote.RemoteWebElement.getCoordinates()647 public org.openqa.selenium.interactions.internal.Coordinates getCoordinates(){648 this.refresh();649 return (org.openqa.selenium.interactions.internal.Coordinates)this.pureElementMethodCall( "getCoordinates" );650 }651 652 // ************************************************************************************************************************ 653 // AndroidElement [49] = public java.util.Map org.openqa.selenium.remote.RemoteWebElement.toJson()654 // IOSElement [46] = public java.util.Map org.openqa.selenium.remote.RemoteWebElement.toJson()655 // MobileElement [48] = public java.util.Map org.openqa.selenium.remote.RemoteWebElement.toJson()656 public java.util.Map<?,?> toJson(){657 this.refresh();658 return (java.util.Map<?,?>)this.pureElementMethodCall( "toJson" );659 }660 661 // ************************************************************************************************************************ 662 // AndroidElement [50] = public void org.openqa.selenium.remote.RemoteWebElement.setId(java.lang.String)663 // IOSElement [47] = public void org.openqa.selenium.remote.RemoteWebElement.setId(java.lang.String)664 // MobileElement [49] = public void org.openqa.selenium.remote.RemoteWebElement.setId(java.lang.String)665 public void setId( java.lang.String Value ) {666 this.refresh();667 this.pureElementMethodCall( "setId", Value );668 }669 670 // ************************************************************************************************************************ 671 // AndroidElement [51] = public final void java.lang.Object.wait() throws java.lang.InterruptedException672 // IOSElement [50] = public final void java.lang.Object.wait() throws java.lang.InterruptedException673 // MobileElement [50] = public final void java.lang.Object.wait() throws java.lang.InterruptedException674 public void waitL(){675 this.refresh();676 this.pureElementMethodCall( "wait" );677 }678 679 // ************************************************************************************************************************ 680 // AndroidElement [52] = public final void java.lang.Object.wait(long,int) throws java.lang.InterruptedException681 // IOSElement [51] = public final void java.lang.Object.wait(long,int) throws java.lang.InterruptedException682 // MobileElement [51] = public final void java.lang.Object.wait(long,int) throws java.lang.InterruptedException683 public void waitL( long waitdelay, int waitdelayms ){684 this.refresh();685 this.pureElementMethodCall( "wait", waitdelay, waitdelayms );686 }687 688 // ************************************************************************************************************************ 689 // AndroidElement [53] = public final native void java.lang.Object.wait(long) throws java.lang.InterruptedException690 // IOSElement [52] = public final native void java.lang.Object.wait(long) throws java.lang.InterruptedException691 // MobileElement [52] = public final native void java.lang.Object.wait(long) throws java.lang.InterruptedException692 public void waitL( long waitdelay ){693 this.refresh();694 this.pureElementMethodCall( "wait", waitdelay );695 }696 697 // ************************************************************************************************************************ 698 // AndroidElement [54] = public final native java.lang.Class java.lang.Object.getClass()699 // IOSElement [53] = public final native java.lang.Class java.lang.Object.getClass()700 // MobileElement [53] = public final native java.lang.Class java.lang.Object.getClass()701 public java.lang.Class<?> getClassL(){702 this.refresh();703 return (java.lang.Class<?>)this.pureElementMethodCall( "getClass" );704 }705 706 // ************************************************************************************************************************ 707 // AndroidElement [55] = public final native void java.lang.Object.notify()708 // IOSElement [54] = public final native void java.lang.Object.notify()709 // MobileElement [54] = public final native void java.lang.Object.notify()710 public void notifyL(){711 this.refresh();712 this.pureElementMethodCall( "notify" );713 }714 715 // ************************************************************************************************************************ 716 // AndroidElement [56] = public final native void java.lang.Object.notifyAll()717 // IOSElement [55] = public final native void java.lang.Object.notifyAll()718 // MobileElement [55] = public final native void java.lang.Object.notifyAll()719 public void notifyAllL(){720 this.refresh();721 this.pureElementMethodCall( "notifyAll" );722 }723 724 // ************************************************************************************************************************ 725 // AndroidElement [57] = public default org.openqa.selenium.WebElement io.appium.java_client.FindsByAccessibilityId.findElementByAccessibilityId(java.lang.String)726 // IOSElement [56] = public default org.openqa.selenium.WebElement io.appium.java_client.FindsByAccessibilityId.findElementByAccessibilityId(java.lang.String)727 // MobileElement [56] = public default org.openqa.selenium.WebElement io.appium.java_client.FindsByAccessibilityId.findElementByAccessibilityId(java.lang.String)728 public pureElement findElementByAccessibilityId( String Description ){729 return this.intFindElementXXX( "findElementByAccessibilityId", pureCore.elementMethod.AccessibilityId, Description );730 }731 732 // ************************************************************************************************************************ 733 // AndroidElement [58] = public default org.openqa.selenium.WebElement io.appium.java_client.FindsByAndroidUIAutomator.findElementByAndroidUIAutomator(java.lang.String)734 public pureElement findElementByAndroidUIAutomator( String Description ){735 return this.intFindElementXXX( "findElementByAndroidUIAutomator", pureCore.elementMethod.AndroidUIAutomator, Description );736 }737 // ************************************************************************************************************************ 738 // AndroidElement [59] = public default java.util.List io.appium.java_client.FindsByAndroidUIAutomator.findElementsByAndroidUIAutomator(java.lang.String)739 public pureElements findElementsByAndroidUIAutomator( String Description ) {740 return this.intFindElementsXXX( "findElementsByAndroidUIAutomator", pureCore.elementMethod.AndroidUIAutomator, Description );741 }742 // ************************************************************************************************************************ 743 // IOSElement [57] = public default org.openqa.selenium.WebElement io.appium.java_client.FindsByIosUIAutomation.findElementByIosUIAutomation(java.lang.String)744 public pureElement findElementByIosUIAutomation( String Description ){745 return this.intFindElementXXX( "findElementByIosUIAutomation", pureCore.elementMethod.IosUIAutomation, Description );746 }747 // ************************************************************************************************************************ 748 // IOSElement [58] = public default java.util.List io.appium.java_client.FindsByIosUIAutomation.findElementsByIosUIAutomation(java.lang.String)749 public pureElements findElementsByIosUIAutomation( String Description ) {750 return this.intFindElementsXXX( "findElementsByIosUIAutomation", pureCore.elementMethod.IosUIAutomation, Description );751 }752 // ************************************************************************************************************************ 753 // IOSElement [59] = public default org.openqa.selenium.WebElement io.appium.java_client.FindsByIosNSPredicate.findElementByIosNsPredicate(java.lang.String)754 public pureElement findElementByIosNsPredicate( String Description ){755 return this.intFindElementXXX( "findElementByIosNsPredicate", pureCore.elementMethod.IosNsPredicate, Description );756 }757 // ************************************************************************************************************************ 758 // IOSElement [60] = public default java.util.List io.appium.java_client.FindsByIosNSPredicate.findElementsByIosNsPredicate(java.lang.String)759 public pureElements findElementsByIosNsPredicate( String Description ) {760 return this.intFindElementsXXX( "findElementsByIosNsPredicate", pureCore.elementMethod.IosNsPredicate, Description );761 }762 // ************************************************************************************************************************ 763 // IOSElement [61] = public default org.openqa.selenium.WebElement io.appium.java_client.FindsByIosClassChain.findElementByIosClassChain(java.lang.String)764 public pureElement findElementByIosClassChain( String Description ){765 return this.intFindElementXXX( "findElementByIosClassChain", pureCore.elementMethod.IosClassChain, Description );766 }767 // ************************************************************************************************************************ 768 // IOSElement [62] = public default java.util.List io.appium.java_client.FindsByIosClassChain.findElementsByIosClassChain(java.lang.String)769 public pureElements findElementsByIosClassChain( String Description ) {770 return this.intFindElementsXXX( "findElementsByIosClassChain", pureCore.elementMethod.IosClassChain, Description );771 }772 // ************************************************************************************************************************ 773 private void refresh() {774 // Si l'Element n'a pas encore ete cherche, ou que son rafraichissement doit etre realise.775 if ( this.theElement == null || this.refreshMethod == 1 ) { // || this.refrehCode != pureCore.getLastLogCat() ) {776 pureDriverDetails myDriver = null;777 if ( this.driverLink == -1 ) {778 myDriver = pureDrivers.getCurrentDriverDetails();779 // this.driverToUse = myDriver;780 }else {781 myDriver = this.driverToUse;782 }783 this.theElement = this.detection();784 // Tout d'abord on réalise une attente pour trouver l'élément.785 /*try {786 this.theElement = (Object)(new WebDriverWait( (WebDriver)pureCore.getCurrentDriver(), pureCore.getMaxWaitDelay() )787 .until( ExpectedConditions.presenceOfElementLocated( By.xpath( pureCore.MethodToLocator( this.eMethod, this.ePath ) ) ) ) );788 }catch( Exception e ) {789 pureErrorHandler.castError( pureErrorHandler.exceptions.getType( e ), "pureElement.refresh()", this.eName, pureCore.MethodToLocator( this.eMethod, this.ePath ) );790 } */791 if ( this.parent == null ) {792 this.theElement = (Object)pureDrivers.findElementWE( pureCore.MethodToLocator( this.eMethod, this.ePath ), myDriver );793 }else {794 this.theElement = (Object)this.parent.findElement( pureCore.MethodToLocator( this.eMethod, this.ePath ) );795 }796 // this.centerOnScreen();797 }798 }799 public Object myObject = null;800 private Object detection() {801 pureDriverDetails myDriver = null;802 if ( this.driverLink == -1 ) {803 myDriver = pureDrivers.getCurrentDriverDetails();804 }else {805 myDriver = this.driverToUse;806 }807 try {808 WebDriverWait objWait = new WebDriverWait( (WebDriver)myDriver.mainDriver, 20, 500 );809 objWait.until( new ExpectedCondition<Boolean>() {810 private pureElement myElement;811 private pureDriverDetails myDriver;812 private ExpectedCondition<Boolean> init( pureElement myElement, pureDriverDetails myDriver ){813 this.myElement = myElement;814 this.myDriver = myDriver;815 return this;816 }817 public Boolean apply(WebDriver wDriver) {818 if( this.myElement.parent == null ) {819 this.myElement.theElement = (Object)pureDrivers.findElementWE( pureCore.MethodToLocator( this.myElement.eMethod, this.myElement.ePath ), this.myDriver );820 }else {821 this.myElement.theElement = (Object)this.myElement.parent.findElement( pureCore.MethodToLocator( this.myElement.eMethod, this.myElement.ePath ) );822 }823 return ( this.myElement.theElement != null );824 }825 }.init( this, myDriver ) );826 827 }catch( Exception e ) {828 pureErrorHandler.castError( pureErrorHandler.exceptions.getType( e ), "pureElement.refresh()", this.eName, pureCore.MethodToLocator( this.eMethod, this.ePath ).toString() );829 }830 return myObject;831 }832 // ************************************************************************************************************************ 833private void centerOnScreen() {834 pureDriverDetails myDriver = pureDrivers.getCurrentDriverDetails();835 // Positionner l'objet au milieu de l'ecran si possible836 if ( this.theElement !=null ) {837 // On recupere d'abord les coordonnees et dimensions de l'objet838 Point pePosition = this.getLocation();839 Dimension peDimension = this.getSize();840 // On recupere ensuite les coordonnees et dimensions de l'ecran visible841 Rectangle cdRectangle = pureDrivers.GetDisplayArea();842 // Si l'objet est plus haut que l'ecran visible (et partiellement ou totalement hors ecran) :...
Source:RemoteWebElementWrapper.java
...507 return original.getScreenshotAs(outputType);508 }509 /**510 * @return511 * @see org.openqa.selenium.remote.RemoteWebElement#toString()512 */513 @Override514 public String toString() {515 return original.toString();516 }517}...
Source:CustomLocatorHandler.java
...205 }206 HttpRequest request = commandCodec.encode(command);207 HttpResponse response = toNode.execute(request);208 Response decoded = responseCodec.decode(response);209 decoded.setSessionId(command.getSessionId().toString());210 return decoded;211 }212 }213 private static class CustomWebDriver extends RemoteWebDriver {214 public CustomWebDriver(CommandExecutor executor, String sessionId) {215 super(executor, new ImmutableCapabilities());216 setSessionId(sessionId);217 }218 @Override219 protected void startSession(Capabilities capabilities) {220 // no-op221 }222 @Override223 public void quit() {...
Source:NewRemoteWebElement.java
...38 setParent((RemoteWebDriver) remoteWebElement.getWrappedDriver());39 configureFileDetector();40 41 // if possible take a locator and a term42 Matcher remoteWebElementInfo = foundByPattern.matcher(remoteWebElement.toString());43 if (remoteWebElementInfo.matches()) {44 setFoundBy(element, remoteWebElementInfo.group(1), remoteWebElementInfo.group(2));45 } else {46 BFLogger.logError("Incorrect FoundBy form WebElement " + remoteWebElement.toString());47 }48 }49 50 public static void setClickTimer() {51 clickTimerOn = true;52 totalClickTime = 0;53 }54 55 public static long dropClickTimer() {56 clickTimerOn = false;57 return totalClickTime;58 }59 60 /**61 * We are setting LocalFileDetector for interactions with a non-local grid, that is a Grid that is physically62 * on another host. Skipping that for local grid has some tiny performance advantage: file will not be sent over63 * network unnecessarily64 */65 private void configureFileDetector() {66 try {67 configureFileDetectorSemaphore.acquire();68 69 if (!Objects.isNull(newRemoteElementFileDetector)) {70 fileDetector = newRemoteElementFileDetector;71 } else {72 fileDetector = isRemoteGrid() ? new LocalFileDetector() : new UselessFileDetector();73 newRemoteElementFileDetector = fileDetector;74 BFLogger.logDebug("FileDetector for all NewRemoteWebElements will be set to " + fileDetector.getClass()75 .getCanonicalName());76 }77 78 configureFileDetectorSemaphore.release();79 } catch (InterruptedException e) {80 BFLogger.logError("FileDetector could not be set. The default will be used");81 }82 }83 84 private static boolean isRemoteGrid() {85 String gridHost = RuntimeParametersSelenium.SELENIUM_GRID.getValue()86 .trim();87 88 return getDriver().getClass()89 .getSimpleName()90 .equals("NewRemoteWebDriver") &&91 !gridHost.startsWith("http://127.0.0.1") &&92 !gridHost.startsWith("http://localhost");93 }94 95 /**96 * @deprecated As of release 1.0.0, replaced by {@link #findElementDynamic(By)()}97 */98 @Deprecated99 @Override100 public WebElement findElement(By by) throws BFElementNotFoundException {101 WebElement element = null;102 try {103 element = super.findElement(by);104 } catch (NoSuchElementException e) {105 throw new BFElementNotFoundException(by);106 }107 return new NewRemoteWebElement(element);108 }109 110 /**111 * @deprecated As of release 1.0.0, replaced by {@link #findElementDynamics(By)()}112 */113 @Deprecated114 @Override115 public List<WebElement> findElements(By by) {116 List<WebElement> elements = new ArrayList<WebElement>();117 for (WebElement element : super.findElements(by)) {118 elements.add(new NewRemoteWebElement(element));119 }120 return elements;121 }122 123 @Override124 public void click() throws StaleElementReferenceException {125 if (clickTimerOn) {126 startClickTime = System.currentTimeMillis();127 }128 try {129 super.click();130 } catch (ElementNotVisibleException e) {131 SelectorComponents selectorComponents = new SelectorComponents(toString());132 throw new BFComponentStateException(selectorComponents.getTerm(), "click", "not visible");133 } catch (StaleElementReferenceException e) {134 By selector = getSelector();135 if (selector == null) {136 calculateClickTime();137 throw e;138 }139 if (!click(selector, CLICK_NUM)) {140 calculateClickTime();141 throw e;142 }143 }144 calculateClickTime();145 }146 147 private void calculateClickTime() {148 if (clickTimerOn) {149 totalClickTime += System.currentTimeMillis() - startClickTime;150 }151 }152 153 private boolean click(By selector, int callNum) {154 try {155 TimeUtills.waitMiliseconds(MICRO_SLEEP);156 getWrappedDriver().findElement(selector)157 .click();158 return true;159 } catch (StaleElementReferenceException e) {160 if (callNum > 0) {161 return click(selector, callNum - 1);162 }163 }164 return false;165 }166 167 private By getSelector() {168 SelectorComponents selectorComponents = new SelectorComponents(toString());169 170 String term = selectorComponents.getTerm();171 if (term == null) {172 BFLogger.logError("Selector is not defined");173 return null;174 }175 176 By selector = null;177 178 String locator = selectorComponents.getLocator();179 switch (locator) {180 case "className selector":181 selector = new By.ByClassName(term);182 break;...
Source:ChromeDriver.java
...111 }112113 public <X> X getScreenshotAs(OutputType<X> target) {114 return target.convertFromBase64Png(execute(SCREENSHOT, ImmutableMap.<String, Object>of())115 .getValue().toString());116 }117}
...
Source:DecoratedRemoteWebDriverTest.java
...56 @Test57 public void canConvertDecoratedRemoteWebElementToJson() {58 RemoteWebDriver originalDriver = mock(RemoteWebDriver.class);59 RemoteWebElement originalElement = new RemoteWebElement();60 String elementId = UUID.randomUUID().toString();61 originalElement.setParent(originalDriver);62 originalElement.setId(elementId);63 when(originalDriver.findElement(any())).thenReturn(originalElement);64 WebDriver decoratedDriver = new WebDriverDecorator().decorate(originalDriver);65 WebElement element = decoratedDriver.findElement(By.id("test"));66 WebElementToJsonConverter converter = new WebElementToJsonConverter();67 ImmutableMap<String, String> result = (ImmutableMap<String, String>) converter.apply(element);68 assertThat(result.get(Dialect.OSS.getEncodedElementKey())).isEqualTo(elementId);69 }70}...
Source:ProxyServletTest.java
...34 }35 @Test36 public void testSessionIdDoesNotChange() {37 RemoteWebDriver driver = new RemoteWebDriver(getUrl(), firefox());38 String sessionId = driver.getSessionId().toString();39 driver.getCurrentUrl();40 driver.get("some url");41 assertThat(driver.getSessionId().toString(), is(equalTo(sessionId)));42 driver.getCurrentUrl();43 assertThat(driver.getSessionId().toString(), is(equalTo(sessionId)));44 }45 @Test46 public void testSessionIdChangesForANewBrowser() {47 RemoteWebDriver driver1 = new RemoteWebDriver(getUrl(), firefox());48 String sessionId1 = driver1.getSessionId().toString();49 RemoteWebDriver driver2 = new RemoteWebDriver(getUrl(), firefox());50 String sessionId2 = driver2.getSessionId().toString();51 assertThat(sessionId1, is(not(equalTo(sessionId2))));52 }53 @Test54 public void testQuit() {55 RemoteWebDriver driver = new RemoteWebDriver(getUrl(), firefox());56 driver.quit();57 }58 @Test59 public void testSendRequestParams() {60 RemoteWebDriver driver = new RemoteWebDriver(getUrl(), firefox());61 String url = "some url";62 driver.getCurrentUrl();63 driver.get(url);64 assertThat(driver.getCurrentUrl(), is(url));...
Source:BeisTestUtilities.java
...20 NdsUiWait wait = new NdsUiWait(driver); 21 wait.untilElementEnabled(By.id("resource"));22 WebElement el = driver.findElement(By.id("resource"));23 System.out.println("selectFile driver class = " +((RemoteWebElement) el).getWrappedDriver().getClass().getName());24 if (((RemoteWebElement) el).getWrappedDriver().getClass().getName().contains("Chrome") || ((RemoteWebElement) el).getWrappedDriver().toString().contains("chrome")) {25 // For Chrome, the fileDetector MUST be set. For Firefox, it MUST NOT be set26 // also Firefox needs the "file:/" prefix to the filename, but it must not be present for Chrome. 27 ((RemoteWebElement) el).setFileDetector(new LocalFileDetector());28 el.sendKeys(chromePath(getFilePath(filename)));29 } else {30 el.sendKeys(geckoDriverPath(getFilePath(filename)));31 }32 }33 34 /** Work out where the files are. */35 private String getFilePath(String fileName) {36 String altFileGridLocation = System.getProperty("nds.integrationTest.uploadFilePath", null);37 38 if (altFileGridLocation != null) {39 return Paths.get(altFileGridLocation, fileName).toString();40 } else {41 return defaultFileLocation + fileName;42 }43 }44 45 private String chromePath(String path) {46 if (path.startsWith("file:/")) {47 return path.substring(6);48 } else {49 return path;50 }51 }52 53 private String geckoDriverPath(String path) {...
toString
Using AI Code Generation
1String text = driver.findElement(By.id("id")).toString();2String text = driver.findElement(By.id("id")).getText();3String text = driver.findElement(By.id("id")).getText();4String text = driver.findElement(By.id("id")).getText();5String text = driver.findElement(By.id("id")).getText();6String text = driver.findElement(By.id("id")).getText();7String text = driver.findElement(By.id("id")).getText();8String text = driver.findElement(By.id("id")).getText();9String text = driver.findElement(By.id("id")).getText();10String text = driver.findElement(By.id("id")).getText();11String text = driver.findElement(By.id("id")).getText();12String text = driver.findElement(By.id("id")).getText();13String text = driver.findElement(By.id("id")).getText();14String text = driver.findElement(By.id("id")).getText();
toString
Using AI Code Generation
1System.out.println(s);2System.out.println(s);3System.out.println(s);4System.out.println(s);5System.out.println(s);6System.out.println(b);7System.out.println(b);8System.out.println(b);9System.out.println(e);10System.out.println(l);
toString
Using AI Code Generation
1String text = ((RemoteWebElement) element).toString();2System.out.println(text);3JSONObject obj = new JSONObject(text);4System.out.println(obj);5String elementText = obj.getString("element-6066-11e4-a52e-4f735466cecf");6System.out.println(elementText);7System.out.println(element.getText());
toString
Using AI Code Generation
1String text = driver.findElement(By.id("gwt-debug-cwBasicButton")).toString();2System.out.println(text);3String text = driver.findElement(By.id("gwt-debug-cwBasicButton")).getText();4System.out.println(text);5String text = driver.findElement(By.id("gwt-debug-cwBasicButton")).getAttribute("text");6System.out.println(text);7String text = driver.findElement(By.id("gwt-debug-cwBasicButton")).getCssValue("text");8System.out.println(text);9String text = driver.findElement(By.id("gwt-debug-cwBasicButton")).getAttribute("textContent");10System.out.println(text);11String text = driver.findElement(By.id("gwt-debug-cwBasicButton")).getCssValue("textContent");12System.out.println(text);13String text = driver.findElement(By.id("gwt-debug-cwBasicButton")).getAttribute("innerText");14System.out.println(text);15String text = driver.findElement(By.id("gwt-debug-cwBasicButton")).getCssValue("innerText");16System.out.println(text);17String text = driver.findElement(By.id("gwt-debug-cwBasicButton")).getAttribute("innerHTML");18System.out.println(text);19String text = driver.findElement(By.id("gwt-debug-cwBasicButton")).getCssValue("innerHTML");
toString
Using AI Code Generation
1package com.company;2import org.openqa.selenium.By;3import org.openqa.selenium.WebDriver;4import org.openqa.selenium.WebElement;5import org.openqa.selenium.chrome.ChromeDriver;6public class Main {7 public static void main(String[] args) {8 System.setProperty("webdriver.chrome.driver", "C:\\Users\\Username\\Downloads\\chromedriver_win32\\chromedriver.exe");9 WebDriver driver = new ChromeDriver();10 WebElement element = driver.findElement(By.name("q"));11 System.out.println(element.toString());12 }13}14from selenium import webdriver15driver = webdriver.Chrome('C:\\Users\\Username\\Downloads\\chromedriver_win32\\chromedriver.exe')16element = driver.find_element_by_name('q')17print(element)18#<selenium.webdriver.remote.webelement.WebElement (session="b1d1d8a8a3b3c3b3a4b4b4b4b4b4b4b4", element="0.1636291070367136-1")>19using System;20using OpenQA.Selenium;21using OpenQA.Selenium.Chrome;22{23 {24 static void Main(string[] args)25 {26 IWebDriver driver = new ChromeDriver("C:\\Users\\Username\\Downloads\\chromedriver_win32");27 IWebElement element = driver.FindElement(By.Name("q"));28 Console.WriteLine(element.ToString());29 driver.Quit();30 }31 }32}
toString
Using AI Code Generation
1String text = element.getAttribute("innerHTML");2System.out.println("Text of the element : " + text);3String text = element.getAttribute("outerHTML");4System.out.println("Text of the element : " + text);5String text = element.getAttribute("textContent");6System.out.println("Text of the element : " + text);7String text = element.getAttribute("innerText");8System.out.println("Text of the element : " + text);9String text = element.getAttribute("value");10System.out.println("Text of the element : " + text);11String text = element.getAttribute("name");12System.out.println("Text of the element : " + text);13String text = element.getAttribute("class");14System.out.println("Text of the element : " + text);
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!!