-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestcase_sample.js
More file actions
32 lines (30 loc) · 895 Bytes
/
testcase_sample.js
File metadata and controls
32 lines (30 loc) · 895 Bytes
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
const EasyDriver = require("./easy-driver");
const lang = "zh-tw";
// New with locale: lang
const easyd = new EasyDriver({ locale: lang, browser: "chrome" });
// Create directory: lang
easyd.createDirectories(lang);
// Open Google
easyd.open("https://www.google.com");
// Maximize the window
easyd.maximizeWindow();
// Search 'webdriver'
easyd.sendKeys("name=q", "webdriver" + easyd.Key.ENTER);
// Wait till search results are done
easyd.waitForVisible("id=rso");
// Red-mark 'Send Feedback'
easyd.drawRedMark('(//*[@class="Fx4vi"])[2]');
// Scroll to 'Send Feedback' at the bottom of the page
easyd.scrollIntoView('(//*[@class="Fx4vi"])[2]');
// Capture the page
easyd.takeScreenshot(`${lang}/sample`);
// Print Title
easyd.getTitle(function(title) {
console.log("Title: " + title);
});
// Clear redmark
easyd.clearAllDrawings();
// Sleep 6 seconds
easyd.sleep(6000);
// Quit
easyd.quit();