Files
004_comission/armandarmand/task1/task1-ticket1/_ref/JavaScript/SimpleGoogleSearch(IE).js
louiscklaw ce9a4aa9b3 update,
2025-01-31 19:27:58 +08:00

22 lines
1.2 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.


/*
* JavaScript example using the Windows scripting engine
*/
var Waiter = new ActiveXObject("Selenium.Waiter");
var Assert = new ActiveXObject("Selenium.Assert");
var driver = new ActiveXObject("Selenium.IEDriver");
//open the browser and the page
driver.get("https://www.google.co.uk");
//type into the search input box
var ele = driver.findElementById("lst-ib");
ele.sendKeys("Eiffel tower" + driver.Keys.Return);
//waits for the title
Waiter.Until(function(){return /^Eiffel tower/.test(driver.Title);});
//waits for the user to click OK
WScript.Echo("Click OK to quit the browser");