vercel / pkg

Package your Node.js project into an executable
https://npmjs.com/pkg
MIT License
24.28k stars 1.01k forks source link

Failed to launch chrome browser from selenium webdriver in exe file #2034

Closed ssk512 closed 8 months ago

ssk512 commented 9 months ago

What version of pkg are you using?

5.8.1

What version of Node.js are you using?

16.10.0

What operating system are you using?

macos

What CPU architecture are you using?

Apple M2

What Node versions, OSs and CPU architectures are you building for?

node16-macos-arm64

Describe the Bug

From the project able to launch browser, after create exe file by pkg, not able to launch browser from selenium driver and throws below error Please check Browser settings Unable to obtain browser driver. For more information on how to install drivers see https://www.selenium.dev/documentation/webdriver/troubleshooting/errors/driver_location/. Error: Unable to obtain Selenium Manager at /snapshot/webex_webapp_ucf/node_modules/selenium-webdriver/bin/macos/selenium-manager 2023-12-07 14:56:17:5617 error: [indexMac.js : 270] Please check config value or failed to launch browser Cannot read properties of null (reading 'switchTo') 2023-12-07 14:56:17:5617 info: [indexMac.js : 455] ENv {"appName":"sdk-samples","appPlatform":"testClient","logger":{"level":"debug"},"meetings":{"reconnection":{"enabled":true},"enableRtx":true,"experimental":{"enableMediaNegotiatedEvent":false,"enableUnifiedMeetings":true,"enableAdhocMeetings":true,"enableTurnDiscovery":false}}} 2023-12-07 14:56:17:5617 error: uncaughtException: Cannot read properties of null (reading 'executeScript') TypeError: Cannot read properties of null (reading 'executeScript') at intialize (/snapshot/webex_webapp_ucf/indexMac.js:457:31) at /snapshot/webex_webapp_ucf/indexMac.js:425:31

Expected Behavior

It should take chromedriver in default path /usr/local/bin

To Reproduce

const {Builder, Browser, By, Key, until} = require('selenium-webdriver');

(async function example() { let driver = await new Builder().forBrowser(Browser.CHROME).build(); try { await driver.get('https://www.google.com/ncr'); await driver.findElement(By.name('q')).sendKeys('webdriver', Key.RETURN); await driver.wait(until.titleIs('webdriver - Google Search'), 1000); } finally { await driver.quit(); } })();

damartripamungkas commented 8 months ago

try make that package to public with command --public-packages