Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using Chrome for Testing #175

Closed
nanasess opened this issue Jun 13, 2023 · 5 comments · Fixed by #192
Closed

Using Chrome for Testing #175

nanasess opened this issue Jun 13, 2023 · 5 comments · Fixed by #192
Assignees

Comments

@nanasess
Copy link
Owner

https://github.com/GoogleChromeLabs/chrome-for-testing

@nanasess
Copy link
Owner Author

Download URLs can be obtained as follows

curl https://googlechromelabs.github.io/chrome-for-testing/known-good-versions-with-downloads.json | jq '.versions[] | select(.version == "116.0.5828.0") | .downloads.chrome[] | select(.platform == "linux64") | .url'
curl https://googlechromelabs.github.io/chrome-for-testing/known-good-versions-with-downloads.json | jq '.versions[] | select(.version == "116.0.5828.0") | .downloads.chromedriver[] | select(.platform == "linux64") | .url'

@nanasess
Copy link
Owner Author

Patch specifying chrome and chromedriver paths.

diff --git a/__tests__/chromedriver.ts b/__tests__/chromedriver.ts
index 4835d5fc..0764e5fd 100644
--- a/__tests__/chromedriver.ts
+++ b/__tests__/chromedriver.ts
@@ -1,14 +1,20 @@
 import { Builder, Capabilities, until, By, Key } from 'selenium-webdriver';
+import { Options, ServiceBuilder } from 'selenium-webdriver/chrome';
 (async () => {
   const timeout = 30000;
+  const options = new Options()
+    .setChromeBinaryPath('/path/to/chrome-linux64/chrome');
+  const serviceBuilder = new ServiceBuilder('/path/to/chromedriver-linux64/chromedriver');
   const driver = new Builder()
     .withCapabilities(Capabilities.chrome())
+    .setChromeOptions(options)
+    .setChromeService(serviceBuilder)
     .build();
   try {
     await driver.get('https://google.com');
     await driver.wait(until.titleContains('Google'), timeout);
     console.log(await driver.getTitle());
-
+    await driver.sleep(10000);
     const searchBox = await driver.findElement(By.name('q'));
     await searchBox.sendKeys('ChromeDriver', Key.RETURN);
     await driver.wait(until.titleContains('ChromeDriver'), timeout);

@nanasess
Copy link
Owner Author

Since I don't have much time available, we are waiting for pull requests from those who can handle the task🙇‍♂️🙏

@mvdbeek
Copy link

mvdbeek commented Jul 26, 2023

Would you be open for a simple solution as outlined in https://developer.chrome.com/blog/chrome-for-testing/#how-can-i-get-chrome-for-testing-binaries ?

It could be as simple as npx @puppeteer/browsers install chrome@stable and npx @puppeteer/browsers install chromedriver@stable ?

@nanasess
Copy link
Owner Author

We have released a version that supports Chrome for Testing.
https://github.com/nanasess/setup-chromedriver/releases/tag/v2.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants