Skip to content

Commit 31dfb43

Browse files
committed
added null check
1 parent 987e9bc commit 31dfb43

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/lib/screenshot.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,11 @@ async function captureScreenshotsForConfig(
3131
else if (browserName == constants.FIREFOX) contextOptions.userAgent = constants.FIREFOX_USER_AGENT;
3232
else if (browserName == constants.SAFARI) contextOptions.userAgent = constants.SAFARI_USER_AGENT;
3333
else if (browserName == constants.EDGE) contextOptions.userAgent = constants.EDGE_USER_AGENT;
34-
if (ctx.config.userAgent || urlConfig.userAgent) {
34+
if (ctx.config.userAgent || userAgent) {
3535
if(ctx.config.userAgent !== ""){
36-
contextOptions.userAgent = ctx.config.userAgent;}
37-
if (urlConfig.userAgent !== "") {
36+
contextOptions.userAgent = ctx.config.userAgent;
37+
}
38+
if (urlConfig.userAgent !== "" && urlConfig.userAgent !== undefined) {
3839
contextOptions.userAgent = userAgent;
3940
}
4041
}

0 commit comments

Comments
 (0)