Advertisement
andyiyass

control chrome profile selenium javascript

Sep 30th, 2022
1,003
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JavaScript 0.67 KB | Source Code | 0 0
  1. const {Builder, Browser, By, Key, until } = require('selenium-webdriver');
  2. const chrome = require("selenium-webdriver/chrome");
  3.  
  4. var options = new chrome.Options();
  5.  
  6. options.addArguments("user-data-dir=C:\\Users\\admin\\AppData\\Local\\Google\\Chrome\\User Data");
  7.  
  8.  
  9. options.addArguments("profile-directory=Profile 50");
  10.  
  11.  
  12.  
  13.  
  14. (async function example() {
  15.   //let driver = await new Builder().forBrowser("chrome").build(); // tidak menggunakan profile
  16.   let driver = await new Builder().forBrowser("chrome").setChromeOptions(options).build(); // mengunakana profile
  17.  
  18.     await driver.get('https://studio.youtube.com');
  19.     await driver.sleep(10000);
  20.  
  21.  
  22. })();
  23.  
  24.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement