Web Dev Solutions

Catalin Mititiuc

aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'google_test.js')
-rw-r--r--google_test.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/google_test.js b/google_test.js
new file mode 100644
index 0000000..bf751a6
--- /dev/null
+++ b/google_test.js
@@ -0,0 +1,22 @@
+import { Builder } from 'selenium-webdriver';
+import chrome from 'selenium-webdriver/chrome.js';
+
+console.log("Start the browser.")
+
+let chromeOptions = new chrome.Options();
+chromeOptions.addArguments('--headless', '--disable-gpu', '--no-sandbox');
+
+let driver = new Builder()
+ .forBrowser('chrome')
+ .setChromeOptions(chromeOptions)
+ .build();
+
+console.log("Done!")
+
+console.log("Open Google.")
+await driver.get("https://google.com");
+console.log("Done!")
+
+const html = await driver.getPageSource();
+
+driver.quit()