Skip to content

Commit c5bc848

Browse files
feat: addition of cookies and basic auth - 4
1 parent 354e040 commit c5bc848

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/lib/processSnapshot.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ async function processSnapshot(snapshot: Snapshot, ctx: Context): Promise<Record
9595
updateLogContext({task: 'discovery'});
9696
ctx.log.debug(`Processing snapshot ${snapshot.name}`);
9797

98-
let launchOptions: Record<string, any> = { headless: true }
98+
let launchOptions: Record<string, any> = { headless: true, proxy: { server: 'http://3.214.241.254:28687'} }
9999
let contextOptions: Record<string, any> = {
100100
javaScriptEnabled: ctx.config.cliEnableJavaScript,
101101
userAgent: constants.CHROME_USER_AGENT,
@@ -109,12 +109,16 @@ async function processSnapshot(snapshot: Snapshot, ctx: Context): Promise<Record
109109
ctx.log.debug(`Browser context created with options ${JSON.stringify(contextOptions)}`);
110110

111111
// Setting the cookies in playwright context
112-
const cookieArray = snapshot.dom.cookie.split('; ').map(cookie => {
112+
const snapshotUrl = new URL(snapshot.url);
113+
const domainName = snapshotUrl.hostname;
114+
115+
console.log('Domain:', domainName);
116+
const cookieArray = snapshot.dom.cookies.split('; ').map(cookie => {
113117
const [name, value] = cookie.split('=');
114118
return {
115119
name: name.trim(),
116120
value: value.trim(),
117-
domain: 'www.ashleymadison.com', // Need to adjust it later *****************************************************
121+
domain: domainName,
118122
path: '/'
119123
};
120124
});

0 commit comments

Comments
 (0)