Compare commits
1 Commits
open_brows
...
edge
| Author | SHA1 | Date | |
|---|---|---|---|
| ad18256217 |
31
src/index.ts
31
src/index.ts
@ -12,16 +12,36 @@ import { getCities } from './lib/cities';
|
||||
import { WebDriverUtils, saveContactInfoToCSV } from './lib/utils';
|
||||
import * as UIActions from './lib/UIActions';
|
||||
import { randomUUID } from 'crypto';
|
||||
|
||||
import os from 'os';
|
||||
import edge from 'selenium-webdriver/edge';
|
||||
|
||||
/**
|
||||
* Function to visit TripAdvisor pages for each city
|
||||
*/
|
||||
async function visitCityPages(): Promise<void> {
|
||||
|
||||
const cities = getCities(path.join(__dirname, '../data/cities.csv'));
|
||||
const userHomeDir = os.homedir(); // gets C:\Users\<YourName>
|
||||
const driverPath = path.join(userHomeDir, 'Documents', 'edgedriver_win64', 'msedgedriver.exe');
|
||||
|
||||
// Configure Edge service to use your custom driver path
|
||||
const service = new edge.ServiceBuilder(driverPath);
|
||||
|
||||
const options = new edge.Options();
|
||||
options.addArguments('--inprivate');
|
||||
options.addArguments('--start-maximized');
|
||||
|
||||
let driver: WebDriver;
|
||||
driver = await new Builder()
|
||||
.forBrowser('MicrosoftEdge')
|
||||
.setEdgeOptions(options)
|
||||
.setEdgeService(service)
|
||||
.build();
|
||||
|
||||
await driver.get('https://www.tripadvisor.com');
|
||||
await WebDriverUtils.wait(5);
|
||||
|
||||
/*
|
||||
|
||||
console.log('Connecting to existing Chrome browser...');
|
||||
|
||||
// Connect to an existing Chrome browser running in debug mode on port 9222
|
||||
const options = new chrome.Options();
|
||||
@ -34,6 +54,11 @@ async function visitCityPages(): Promise<void> {
|
||||
.forBrowser('chrome')
|
||||
.setChromeOptions(options)
|
||||
.build();
|
||||
*/
|
||||
|
||||
const cities = getCities(path.join(__dirname, '../data/cities.csv'));
|
||||
|
||||
console.log('Connecting to existing Chrome browser...');
|
||||
|
||||
// Visit each city's TripAdvisor page
|
||||
for (let i = 0; i < cities.length; i++) {
|
||||
|
||||
Reference in New Issue
Block a user