Przeglądaj źródła

Working chrome headless version

Berislav 8 lat temu
rodzic
commit
95240cda25
1 zmienionych plików z 6 dodań i 8 usunięć
  1. 6 8
      index.js

+ 6 - 8
index.js

@@ -5,32 +5,30 @@ const chromedriver = require('chromedriver');
 const port = 9515;
 const args = [
   // '--url-base=/wd/hub',
-  `--port=${port}`
+  `--port=${port}`,
 ];
 
-console.log(args);
-
 console.log('start chromedriver');
-chromedriver.start(args);
+const service = chromedriver.start(args);
 console.log('after start')
 
 const options = {
   port,
   path: '/',
   desiredCapabilities: {
-    port,
     browserName: 'chrome',
+    chromeOptions: {
+      args: ['--headless', '--disable-gpu'],
+    }
   },
 };
 
-webdriverio
+const client = webdriverio
   .remote(options)
   .init()
   .on('error', (e) => console.error(e))
   .once('end', () => {
-    console.log('end');
     process.nextTick(function () {
-      console.log('stopping');
       chromedriver.stop();
     });
   })