-
Notifications
You must be signed in to change notification settings - Fork 0
/
testseleniumJS.js
78 lines (53 loc) · 2.39 KB
/
testseleniumJS.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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
/* Created by evangelineireland on 1/5/15.*/
var webdriver = require("selenium-webdriver");
function createDriver() {
var browser = new webdriver.Builder()
.usingServer('http://localhost:4444/wd/hub')
.withCapabilities({'browserName':'firefox'})
.build();
browser.manage().timeouts().setScriptTimeout(10000);
return browser;
}
var browser = createDriver();
browser.get('http://codap.concord.org/releases/latest/static/dg/en/cert/index.html?moreGames=%5B%7B%22name%22:%22Performance%20Harness%22,%22dimensions%22:%7B%229width%22:400,%22height%22:250%7D,%22url%22:%22http://concord-consortium.github.io/codap-data-interactives//PerformanceHarness/PerformanceHarness.html%22%7D%5D');
var tableButton = browser.findElement(webdriver.By.xpath('//div/canvas[@alt="Table"]'));
tableButton.click();
var iframeLoc = browser.findElements(webdriver.By.tagName("iframe"));
browser.switchTo().frame(iframeLoc);
var trials = browser.findElement(webdriver.By.name("numTrials"));
trials.clear();
trials.sendKeys('200');
var runButton = browser.findElement(webdriver.By.name("run"));
runButton.click();
//browser.getTitle().then(function(title) {
// require('assert').equal('webdriver - Google Search', title);
// });
//browser.quit();
/* browser.get("http://codap.concord.org/releases/build_0278/static/dg/en/cert/index.html?moreGames=%5B%7B%22name%22:%22Performance%20Harness%22,%22dimensions%22:%7B%229width%22:400,%22height%22:250%7D,%22url%22:%22http://concord-consortium.github.io/codap-data-interactives//PerformanceHarness/PerformanceHarness.html%22%7D%5D");
browser.getTitle().then(function (title) {
console.log(title);
});
var trials = browser.findElements(webdriver.By.name('numTrials'));
trials.then(function(trials){
trials.clear;
trials.sendKeys('200');
var runButton = browser.findElement(webdriver.By.name('run'));
runButton.click();*/
/*var tableButton = driver.findElement(webdriver.By.xpath("//div[@title='Open/close the case table (ctrl-alt-t)']"))
.then(function(tableBtn){
console.log(tableBtn);
})
tableButton.click();*/
/*
var frame = browser.findElements(webdriver.By.css("iframe"));
frame.then(function(frame){
driver.switch_to.frame(frame);
});
var trials = browser.findElements(webdriver.By.name('numTrials'));
trials.then(function(trials){
trials.clear;
trials.sendKeys('200');
})
*/
//browser.findElements(By.XPath("//div[label='Login as guest']"));
//