How to use the casper.selectXPath function in casper

To help you get started, we’ve selected a few casper examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tebelorg / Tump / TagUI-Python / tagui_header.js View on Github external
function save_table(file_name,selector) {var ds; if (flow_path.indexOf('/') !== -1) ds = '/'; else ds = '\\';
if (!file_name) {save_text_count++; file_name = flow_path + ds + 'table' + save_text_count.toString() + '.csv';}
var row_data = ""; var table_cell = ""; var fs = require('fs'); fs.write(file_name, '', 'w'); // always reset file
if (!casper.exists(selector) || (selector.toString().indexOf('xpath selector: ')==-1)) return false; // exit if invalid
if (selector.toString().length == 16) selector = ''; else selector = selector.toString().substring(16); // get xpath
for (table_row=1; table_row<=1024; table_row++) {row_data = ""; for (table_col=1; table_col<=1024; table_col++) {
table_cell = '(((' + selector + '//tr)[' + table_row + ']//th)' + '|'; // build cell xpath selector to include
table_cell += '((' + selector + '//tr)[' + table_row + ']//td))[' + table_col + ']'; // both td and td elements
if (casper.exists(xps666(table_cell))) row_data = row_data + '","' + casper.fetchText(xps666(table_cell)).trim();
else break;} // if searching for table cells (th and td) is not successful,  means end of row is reached
if (row_data.substr(0,2) == '",') {row_data = row_data.substr(2); row_data += '"'; append_text(file_name,row_data);}
else return true;}} // if '",' is not found, means end of table is reached as there is no cell found in row
github att / rcloud / tests / anonymous_user / tc_52.3.1.js View on Github external
casper.then(function () {
		this.click(x(".//*[@id='rcloud-navbar-menu']/li[3]/a/b"));
        console.log("Opening dropdown");
        this.click(x(".//*[@id='publish_notebook']/i"));
        console.log("Publishing Notebook");
        this.wait(4000);
    });
github att / rcloud / tests / shareable_links / anonymous_view.js View on Github external
casper.then(function () {
		this.click(x(".//*[@id='rcloud-navbar-menu']/li[3]/a/b"));
        console.log("Opening dropdown");
        this.click(x(".//*[@id='publish_notebook']/i"));
        console.log("Publishing Notebook");
        this.wait(4000);
    });
github att / rcloud / tests / asset / tc_14.1.11.js View on Github external
casper.wait(3000).then(function () {
        this.click(x(".//*[@id='upload-submit']"));
        console.log("Clicking on Submit icon");
        this.wait(2000);
        this.waitUntilVisible(x('//*[contains(text(), "replaced")]'), function then() {
            console.log("Asset with duplicate name is not created, instead entire asset got replaced");
        });
    });
github att / rcloud / tests / asset / tc_14.1.11.js View on Github external
casper.wait(5000).then(function () {
        this.waitUntilVisible(x('//*[contains(text(), "added")]'), function then() {
            console.log("File has been uploaded");
        });
        this.test.assertSelectorHasText(x(".//*[@id='asset-list']/li[3]/a/span[1]"), 'PHONE.csv', 'Uploaded file is present in assets');
    });
github att / rcloud / tests / asset / tc_14.1.2.js View on Github external
casper.then(function () {
        this.wait(5000);
        this.waitUntilVisible(x('//*[contains(text(), "added")]'), function then() {
            console.log("File has been uploaded");
        });
    });
github att / rcloud / tests / asset / tc_14.1.14.js View on Github external
casper.wait(2000).then(function () {
        this.wait(5000);
        this.waitUntilVisible(x('//*[contains(text(), "added")]'), function then() {
            console.log("File has been uploaded");
        });
    });
github att / rcloud / tests / file_upload / tc_12.1.2.js View on Github external
casper.then(function () {
        this.wait(5000);
        this.waitUntilVisible(x('//*[contains(text(), "Overwrite")]'), function then() {
            console.log("Overwrite button exists");
        });

        casper.waitForSelector(x(".//*[@id='file-upload-results']/div/div/p/a"), function () {
            casper.click(x(".//*[@id='file-upload-results']/div/div/p/a"));
            console.log("Clicking on Overwrite button");
        });

        this.waitUntilVisible(".alert.alert-info", function then() {
            console.log("File has been replaced");
        });
    });
github att / rcloud / tests / file_upload / tc_12.2.3.js View on Github external
casper.wait(10000).then(function () {
        this.waitUntilVisible(x('//*[contains(text(), "added")]'), function then() {
            console.log("File has been uploaded");
        });
        this.test.assertSelectorHasText(x(".//*[@id='asset-list']/li[3]/a/span[1]"), 'PHONE.csv', 'Uploaded file is present in assets div');
    });
github att / rcloud / tests / asset / tc_14.1.11.js View on Github external
casper.wait(5000).then(function () {
        this.waitUntilVisible(x('//*[contains(text(), "added")]'), function then() {
            console.log("File has been uploaded");
        });
        this.test.assertSelectorHasText(x(".//*[@id='asset-list']/li[3]/a/span[1]"), 'PHONE.csv', 'Uploaded file is present in assets');
    });

casper

Helpers and handlers for building APIs in express.

MIT
Latest version published 11 years ago

Package Health Score

42 / 100
Full package analysis

Popular casper functions