From acfd33e3f342154148ea3d883723e062f52a27ff Mon Sep 17 00:00:00 2001 From: ben Date: Fri, 24 Feb 2017 22:08:43 -0800 Subject: [PATCH 1/6] Added sample script using DIG to list the Authoriative name servers of a top level domain (TLD) --- scripts/dig.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 scripts/dig.js diff --git a/scripts/dig.js b/scripts/dig.js new file mode 100644 index 0000000..aa772e8 --- /dev/null +++ b/scripts/dig.js @@ -0,0 +1,26 @@ +var b = pizza.open('https://toolbox.googleapps.com/apps/dig/'); + +pizza.sleep(1000); +// b.waitPageLoad(); // script has been getting hung up + +var domains = ['walmart.com', 'amazon.com']; + +b.type('#domain', domains[Math.floor((Math.random() * domains.length - 1) + 1)]); + +b.click('xpath://input[@value="NS"]'); + +b.waitForVisible('#response-text'); + +var html = b.getInnerHTML('xpath://*[@id="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 From ce8b88c6c531b49c7e09f1bdb19abaa4dc014004 Mon Sep 17 00:00:00 2001 From: ben Date: Fri, 24 Feb 2017 22:39:59 -0800 Subject: [PATCH 2/6] Added sample script using DIG to list the Authoriative name servers of a top level domain (TLD) --- scripts/dig.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/dig.js b/scripts/dig.js index aa772e8..3c90ada 100644 --- a/scripts/dig.js +++ b/scripts/dig.js @@ -7,7 +7,8 @@ var domains = ['walmart.com', 'amazon.com']; b.type('#domain', domains[Math.floor((Math.random() * domains.length - 1) + 1)]); -b.click('xpath://input[@value="NS"]'); +var records = ['A', 'AAAA', 'ANY', 'CNAME', 'MX', 'NS', 'PTR', 'SOA', 'SRV', 'TXT']; +b.click('xpath://input[@value="' + records[5] + '"]'); b.waitForVisible('#response-text'); From 08bed1c0889e9d9098509ed802da7ea5d8a7b917 Mon Sep 17 00:00:00 2001 From: ben Date: Thu, 9 Mar 2017 18:23:33 -0800 Subject: [PATCH 3/6] Added sample script using DIG to list the Authoriative name servers of a top level domain (TLD) --- scripts/basic.js | 5 +++++ 1 file changed, 5 insertions(+) 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"); From 5740f4a02de883ef45c48d3b076f27d7e620348b Mon Sep 17 00:00:00 2001 From: ben Date: Thu, 9 Mar 2017 18:35:58 -0800 Subject: [PATCH 4/6] Added sample script using DIG to list the Authoriative name servers of a top level domain (TLD) --- scripts/dig.js | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/scripts/dig.js b/scripts/dig.js index 3c90ada..28bfcb0 100644 --- a/scripts/dig.js +++ b/scripts/dig.js @@ -1,27 +1,26 @@ -var b = pizza.open('https://toolbox.googleapps.com/apps/dig/'); +var b = pizza.open("https://toolbox.googleapps.com/apps/dig/"); -pizza.sleep(1000); -// b.waitPageLoad(); // script has been getting hung up +b.waitForVisible("#domain"); -var domains = ['walmart.com', 'amazon.com']; +var domains = ["walmart.com", "amazon.com"]; -b.type('#domain', domains[Math.floor((Math.random() * domains.length - 1) + 1)]); +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] + '"]'); +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('xpath://*[@id="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]); - + authNameServers.push(match[1].split("@")[1]); } console.log(authNameServers); \ No newline at end of file From 94f0a62c31b9fd7f412f2a6e785c21a5d95f588a Mon Sep 17 00:00:00 2001 From: ben Date: Sat, 18 Mar 2017 20:39:12 -0700 Subject: [PATCH 5/6] Merge branch 'master' of https://github.com/loadtestgo/pizzascript --- script-api/pizzascript.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 From bab66eaf7176f907d449b6a437874531672a9e94 Mon Sep 17 00:00:00 2001 From: ben Date: Sat, 18 Mar 2017 20:53:18 -0700 Subject: [PATCH 6/6] Merge branch 'master' of https://github.com/loadtestgo/pizzascript Made update to getOuterHTML methods --- .../src/main/java/com/loadtestgo/script/api/Browser.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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