@@ -77,6 +77,10 @@ async function takeScreenshot(driver, filename) {
77
77
}
78
78
79
79
async function generateErrorReport ( driver ) {
80
+ //write dom
81
+ const dom = await driver . findElement ( By . css ( "html" ) ) . getAttribute ( "outerHTML" )
82
+ fs . writeFileSync ( "error.html" , dom )
83
+
80
84
await takeScreenshot ( driver , "error.png" )
81
85
82
86
const logs = await driver . manage ( ) . logs ( ) . get ( "browser" )
@@ -109,7 +113,7 @@ async function getDriverOptions() {
109
113
options . addArguments ( "--dns-prefetch-disable" )
110
114
options . addArguments ( "--disable-crash-reporter" )
111
115
options . addArguments ( "--disable-popup-blocking" )
112
- options . addArguments ( "--disable-gpu" )
116
+ // options.addArguments("--disable-gpu")
113
117
options . addArguments ( "--allow-running-insecure-content" )
114
118
options . addArguments ( "--disable-web-security" )
115
119
options . addArguments ( "--ignore-certificate-errors" )
@@ -119,9 +123,10 @@ async function getDriverOptions() {
119
123
options . addArguments ( "--no-first-run" )
120
124
options . addArguments ( "--no-default-browser-check" )
121
125
options . addArguments ( "--disable-default-apps" )
126
+ options . addArguments ( "--enable-unsafe-swiftshader" )
122
127
123
128
if ( ! ALLOW_DEBUG ) {
124
- options . addArguments ( "--blink-settings=imagesEnabled=false" )
129
+ // options.addArguments("--blink-settings=imagesEnabled=false")
125
130
}
126
131
127
132
if ( PROXY ) {
@@ -236,6 +241,8 @@ async function getProxyIpInfo(driver, proxyUrl) {
236
241
237
242
await driver . get ( `chrome-extension://${ extensionId } /popup.html` )
238
243
244
+ console . log ( "-> Extension opened!" )
245
+
239
246
// 直到找到 "Status" 文本的 div 元素
240
247
await driver . wait (
241
248
until . elementLocated ( By . xpath ( '//div[contains(text(), "Status")]' ) ) ,
@@ -340,6 +347,8 @@ async function getProxyIpInfo(driver, proxyUrl) {
340
347
341
348
if ( driver ) {
342
349
await generateErrorReport ( driver )
350
+ console . error ( "-> Error report generated!" )
351
+ console . error ( fs . readFileSync ( "error.log" ) . toString ( ) )
343
352
driver . quit ( )
344
353
process . exit ( 1 )
345
354
}
0 commit comments