Skip to content

Commit

Permalink
#1036 - added appeared(), = visible() with timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
kensoh committed May 22, 2021
1 parent a321763 commit bc8d343
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/tagui_header.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,10 @@ else {var element_located = tx(element_locator); var element_visible = casper.el
// if tx() returns xps666('/html') means that the element is not found, so set element_visible to false
if (element_located.toString() == xps666('/html').toString()) element_visible = false; return element_visible;}}

// visible() function that waits until timeout before returning result
function appeared(element_identifier) {var appeared_timeout = Date.now() + casper.options.waitTimeout;
while (Date.now() < appeared_timeout) {if (visible(element_identifier)) return true; else sleep(100);}; return false;}

// friendlier name to count elements using countElements()
function count(element_locator) {if (!element_locator) return 0;
var element_located = tx(element_locator); var element_count = casper.countElements(element_located);
Expand Down
6 changes: 6 additions & 0 deletions src/test/positive_test.signature
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,10 @@ else {var element_located = tx(element_locator); var element_visible = casper.el
// if tx() returns xps666('/html') means that the element is not found, so set element_visible to false
if (element_located.toString() == xps666('/html').toString()) element_visible = false; return element_visible;}}

// visible() function that waits until timeout before returning result
function appeared(element_identifier) {var appeared_timeout = Date.now() + casper.options.waitTimeout;
while (Date.now() < appeared_timeout) {if (visible(element_identifier)) return true; else sleep(100);}; return false;}

// friendlier name to count elements using countElements()
function count(element_locator) {if (!element_locator) return 0;
var element_located = tx(element_locator); var element_count = casper.countElements(element_located);
Expand Down Expand Up @@ -1462,6 +1466,8 @@ phantom.onError = function(msg, trace) {if (msg.indexOf('Error:') !== -1) { // c
msg = msg.substring(msg.indexOf('Error:')+6).trim(); msg = msg.charAt(0).toLowerCase() + msg.slice(1);}
casper.echo('ERROR - ' + msg).exit();}

// define repository and datatable variables

// flow path for save_text and snap_image
var flow_path = '/full_path';

Expand Down

0 comments on commit bc8d343

Please sign in to comment.