diff --git a/script-api/pizzascript.js b/script-api/pizzascript.js index fc01100..aa07a1b 100644 --- a/script-api/pizzascript.js +++ b/script-api/pizzascript.js @@ -1416,26 +1416,26 @@ Browser.prototype.setValue = function(selector, value) {}; * Get the html inside the given element * * @example - * var html = b.getInnerHTML('#input1'); + * var html = b.getInnerHtml('#input1'); * * @param {String} selector the element to get the HTML from * @return {String} the inner HTML for the given element * @throws Throws an exception if the element can not be found */ -Browser.prototype.getInnerHTML = function(selector) {}; +Browser.prototype.getInnerHtml = function(selector) {}; /** * Get the html for the given element or the entire frame if * no element specified. * * @example - * var html = b.getInnerHTML(); + * var html = b.getInnerHtml(); * * @param {String=} selector the element to get the HTML for * @return {String} the outer HTML for the given element * @throws Throws an exception if the element can not be found */ -Browser.prototype.getOuterHTML = function(selector) {}; +Browser.prototype.getOuterHtml = function(selector) {}; /** * Get the text inside the given element diff --git a/script-api/src/main/java/com/loadtestgo/script/api/Browser.java b/script-api/src/main/java/com/loadtestgo/script/api/Browser.java index 7b55d32..e3c637a 100644 --- a/script-api/src/main/java/com/loadtestgo/script/api/Browser.java +++ b/script-api/src/main/java/com/loadtestgo/script/api/Browser.java @@ -646,7 +646,7 @@ public interface Browser { * @param selector the element to get the HTML from * @return the inner HTML for the given element */ - String getInnerHTML(String selector); + String getInnerHtml(String selector); /** * Get the html for the given element @@ -654,7 +654,7 @@ public interface Browser { * @param selector the element to get the HTML for * @return the outer HTML for the given element */ - String getOuterHTML(String selector); + String getOuterHtml(String selector); /** * Get the html for the entire currently selected frame. @@ -663,7 +663,7 @@ public interface Browser { * * @return the outer HTML for the current frame. */ - String getOuterHTML(); + String getOuterHtml(); /** * Get the text inside the given element diff --git a/scripts/basic.js b/scripts/basic.js index e3326cf..070e663 100644 --- a/scripts/basic.js +++ b/scripts/basic.js @@ -1,2 +1,7 @@ +// Open the browser and navigate to the requested URL +// NOTE: A browser instance can be opened without initially +// setting the URL, see script: sitelogin.js b = pizza.open("www.google.com"); + +// Verify the following text exists on the page b.verifyText("Google"); diff --git a/scripts/dig.js b/scripts/dig.js new file mode 100644 index 0000000..10a0778 --- /dev/null +++ b/scripts/dig.js @@ -0,0 +1,29 @@ +// Script using Google's hosted DIG (DNS) utility to log +// the Authoritative nameservers of the requested domain + +var b = pizza.open("https://toolbox.googleapps.com/apps/dig/"); + +b.waitForVisible("#domain"); + +var domains = ["walmart.com", "amazon.com"]; + +b.type("#domain",utils.randomElement(domains)); + +var records = ["A", "AAAA", "ANY", "CNAME", "MX", "NS", "PTR", "SOA", "SRV", "TXT"]; + +// b.click("xpath://input[@value=\"" + records[5] + "\"]"); +b.click("input[value=\"" + records[5] + "\"]"); + +b.waitForVisible('#response-text'); + +var html = b.getInnerHTML('#response-text'); + +var re = /href="(.*?)"/g; + +var authNameServers = []; + +while(match = re.exec(html)){ + authNameServers.push(match[1].split("@")[1]); +} + +console.log(authNameServers); \ No newline at end of file diff --git a/scripts/lookingglass.js b/scripts/lookingglass.js new file mode 100644 index 0000000..fbe2b4f --- /dev/null +++ b/scripts/lookingglass.js @@ -0,0 +1,24 @@ +// Script to lookup and log the IPv4 peered +// Autonomous System Numbers (ASN) of the domain + +var b = pizza.open('http://bgp.he.net/'); + +var domains = ['walmart.com', 'amazon.com']; + +b.type('#search_search', utils.randomElement(domains)); + +b.click("xpath://input[@name=\"commit\"]"); + +b.waitPageLoad(); + +b.waitForVisible('#tab_ipinfo'); + +b.click('#tab_ipinfo'); + +b.waitForElement('a:contains(AS)'); + +b.click('a:contains(AS)') + +b.waitPageLoad(); + +console.log(b.getInnerText(".toppeertable")); \ No newline at end of file