BrowserWrapper Reference
Wrapper for driver functionality
Source code in BrowserWrapper/browserwrapper.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 |
|
acceptAlert()
Accepts an active alert on a page
Source code in BrowserWrapper/browserwrapper.py
636 637 638 639 640 641 |
|
alertIsPresent(*, accept_if_present=False)
Determines if an alert is present
Returns:
Type | Description |
---|---|
Boolean -- True if alert is present, False if not |
Source code in BrowserWrapper/browserwrapper.py
194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 |
|
back()
Uses the browser back functionality to go to the previous page.
Source code in BrowserWrapper/browserwrapper.py
643 644 645 646 647 |
|
change_monitor(*, previous_data=None)
Determines changes due to actions by providing a snapshot of the current state before the action, and comparing to that snapshot afterwards.
Source code in BrowserWrapper/browserwrapper.py
110 111 112 113 114 115 116 117 118 119 |
|
check(element_tuple, *, wrapper_element_tuple=None)
Check a checkbox if it's not already. For checkboxes which can't be interacted with directly (hidden but toggled via JS detecting a click on a different object), provide a wrapper element in addition for the click instead.
Source code in BrowserWrapper/browserwrapper.py
513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 |
|
clearText(element_tuple)
Clear the text of an element, typically an input field
Source code in BrowserWrapper/browserwrapper.py
424 425 426 427 428 429 430 431 432 |
|
click(element_tuple)
Click on an element
Source code in BrowserWrapper/browserwrapper.py
434 435 436 437 438 439 440 441 442 443 444 |
|
delay(length)
Delay for a specified period of time. Should be used as a last resort if no other wait function works.
Source code in BrowserWrapper/browserwrapper.py
555 556 557 558 559 560 561 562 |
|
deleteAllCookies()
Deletes all cookies
Source code in BrowserWrapper/browserwrapper.py
631 632 633 634 |
|
disable_logging()
Used to temporarily disable action logging
Source code in BrowserWrapper/browserwrapper.py
84 85 86 87 88 89 |
|
elementIsChecked(element_tuple)
Determine if a checkbox element is checked or unchecked Note: An exception will be raised if the element is not present.
Returns:
Type | Description |
---|---|
Boolean -- True if element is checked, False otherwise |
Source code in BrowserWrapper/browserwrapper.py
180 181 182 183 184 185 186 187 188 189 190 191 192 |
|
elementIsClickable(element_tuple)
Determine the clickability of an element.
Returns:
Type | Description |
---|---|
Boolean -- True if element is clickable, False otherwise |
Source code in BrowserWrapper/browserwrapper.py
136 137 138 139 140 141 142 143 144 145 146 147 |
|
elementIsPresent(element_tuple)
Determine the current presence of an element.
Returns:
Type | Description |
---|---|
Boolean -- True if element is present, False otherwise |
Source code in BrowserWrapper/browserwrapper.py
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 |
|
elementIsVisible(element_tuple)
Determine the current visibility of an element Note: An exception will be raised if the element is not present.
Returns:
Type | Description |
---|---|
Boolean -- True if element is visible, False otherwise |
Source code in BrowserWrapper/browserwrapper.py
166 167 168 169 170 171 172 173 174 175 176 177 178 |
|
format_element(element)
Changes an element tuple into the format required for unpacking by stripping all items other than locator method and locator string. This should be used to interact with CORE functionality, by unpacking the output of this function.
Returns:
Type | Description |
---|---|
locate_method, locator |
Source code in BrowserWrapper/browserwrapper.py
121 122 123 124 125 126 127 128 129 130 131 |
|
getAttribute(element_tuple, attribute)
Get the value of an element's attribute
Returns:
Type | Description |
---|---|
string -- Value of the provided attribute |
Source code in BrowserWrapper/browserwrapper.py
564 565 566 567 568 569 570 571 572 573 574 575 576 |
|
getSelectedOption(element_tuple)
Get the currently selected option in select element
Source code in BrowserWrapper/browserwrapper.py
502 503 504 505 506 507 508 509 510 511 |
|
getText(element_tuple)
Get the text of an element.
Returns:
Type | Description |
---|---|
string -- Text within the element |
Source code in BrowserWrapper/browserwrapper.py
395 396 397 398 399 400 401 402 403 404 405 406 |
|
getUrl()
Get URL of the current window.
Returns:
Type | Description |
---|---|
string -- Current URL |
Source code in BrowserWrapper/browserwrapper.py
589 590 591 592 593 594 595 596 597 |
|
is_alive()
Determine the current state of the driver object, useful when needing to detect if the browser crashed
Returns:
Type | Description |
---|---|
[bool] -- True if the browser is still alive, False otherwise |
Source code in BrowserWrapper/browserwrapper.py
98 99 100 101 102 103 104 105 106 107 108 |
|
log_info(msg, *args, **kwargs)
Wraps info logging functionality so that it can skipped if needed
Source code in BrowserWrapper/browserwrapper.py
72 73 74 75 76 |
|
log_warning(msg, *args, **kwargs)
Wraps warning logging functionality so that it can skipped if needed
Source code in BrowserWrapper/browserwrapper.py
78 79 80 81 82 |
|
mouseOver(element_tuple)
Move the mouse over an element
Source code in BrowserWrapper/browserwrapper.py
446 447 448 449 450 451 452 453 454 |
|
navigate(url)
Navigate to a url
Source code in BrowserWrapper/browserwrapper.py
385 386 387 388 389 390 391 392 393 |
|
quit(*, only_if_alive=False)
Quits the browser.
Source code in BrowserWrapper/browserwrapper.py
649 650 651 652 653 654 |
|
refresh()
Refresh the current window.
Source code in BrowserWrapper/browserwrapper.py
599 600 601 602 603 |
|
revert_logging()
Reverting action logging to original settings
Source code in BrowserWrapper/browserwrapper.py
91 92 93 94 95 96 |
|
scrollToElement(element_tuple)
Scroll to an element
Source code in BrowserWrapper/browserwrapper.py
456 457 458 459 460 461 462 463 464 465 466 |
|
selectOptionByLabel(element_tuple, select_label)
Select an option by label (visible text) for a select element
Source code in BrowserWrapper/browserwrapper.py
479 480 481 482 483 484 485 486 487 488 |
|
selectOptionByValue(element_tuple, select_value)
Select an option by value for a select element
Source code in BrowserWrapper/browserwrapper.py
468 469 470 471 472 473 474 475 476 477 |
|
selectRandomOption(element_tuple)
Select an random option for a select element
Source code in BrowserWrapper/browserwrapper.py
490 491 492 493 494 495 496 497 498 499 500 |
|
sendKeys(element_tuple, keys)
Send keys to an element
Source code in BrowserWrapper/browserwrapper.py
578 579 580 581 582 583 584 585 586 587 |
|
setText(element_tuple, text)
Clear an element, then sends keys to it. Typically used for form inputs.
Source code in BrowserWrapper/browserwrapper.py
408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 |
|
switchToDefaultContent()
Switches from iframe to default content in the DOM
Source code in BrowserWrapper/browserwrapper.py
615 616 617 618 619 |
|
switchToFrame(element_tuple)
Switches to the specified iframe in the DOM
Source code in BrowserWrapper/browserwrapper.py
605 606 607 608 609 610 611 612 613 |
|
switchToWindowByIndex(index)
Switches to window with provided index
Source code in BrowserWrapper/browserwrapper.py
621 622 623 624 625 626 627 628 629 |
|
uncheck(element_tuple, *, wrapper_element_tuple=None)
Uncheck a checkbox if it's not already. For checkboxes which can't be interacted with directly (hidden but toggled via JS detecting a click on a different object), provide a wrapper element in addition for the function to click instead.
Source code in BrowserWrapper/browserwrapper.py
534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 |
|
waitForAlertPresent(*, timeout=5)
Wait a configurable period of time for an element to be present.
Returns:
Type | Description |
---|---|
Boolean -- True if alert is initially present or becomes present during the wait period, False otherwise |
Source code in BrowserWrapper/browserwrapper.py
297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 |
|
waitForElementClickable(element_tuple, *, timeout=5)
Wait a configurable period of time for an element to be clickable. Note: An exception will be raised if the element is not present.
Returns:
Type | Description |
---|---|
Boolean -- True if element is initially clickable or becomes clickable during the wait period, False otherwise |
Source code in BrowserWrapper/browserwrapper.py
314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 |
|
waitForElementNotPresent(element_tuple, *, timeout=5)
Wait a configurable period of time for an element to not be present.
Returns:
Type | Description |
---|---|
Boolean -- True if element is initially not present or becomes not present during the wait period, False otherwise |
Source code in BrowserWrapper/browserwrapper.py
274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 |
|
waitForElementNotVisible(element_tuple, *, timeout=5)
Wait a configurable period of time for an element to be invisible. Note: An exception will be raised if the element is not present
Returns:
Type | Description |
---|---|
Boolean -- True if element is initially invisible or becomes invisible during the wait period, False otherwise |
Source code in BrowserWrapper/browserwrapper.py
237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 |
|
waitForElementPresent(element_tuple, *, timeout=5)
Wait a configurable period of time for an element to be present.
Returns:
Type | Description |
---|---|
Boolean -- True if element is initially present or becomes present wait period, False otherwise |
Source code in BrowserWrapper/browserwrapper.py
256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 |
|
waitForElementTextChange(element_tuple, original_text, *, timeout=5)
Wait a configurable period of time for an element's text to change
Source code in BrowserWrapper/browserwrapper.py
363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 |
|
waitForElementVisible(element_tuple, *, timeout=5)
Wait a configurable period of time for an element to be visible. Note: An exception will be raised if the element is not present
Returns:
Type | Description |
---|---|
Boolean -- True if element is initially visible or becomes visible during the wait period, False otherwise |
Source code in BrowserWrapper/browserwrapper.py
218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 |
|
waitForURLToContain(url_portion, *, timeout=5)
Wait a configurable period of time for the current URL to contain a given string.
Source code in BrowserWrapper/browserwrapper.py
333 334 335 336 337 338 339 340 341 342 343 344 345 346 |
|
waitForURLToEqual(url, *, timeout=5)
Wait a configurable period of time for the current URL to equal a given string.
Source code in BrowserWrapper/browserwrapper.py
348 349 350 351 352 353 354 355 356 357 358 359 360 361 |
|