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

Add Extra --no-sandbox #123

Merged
merged 1 commit into from
Jun 18, 2024
Merged

Add Extra --no-sandbox #123

merged 1 commit into from
Jun 18, 2024

Conversation

jdeath
Copy link

@jdeath jdeath commented Jun 18, 2024

Adding --no-sandbox option in def getChromeVersion(self) needed to run in docker headless. Get

Confirmed did not affect running normally in Windows.

Without switch, get following error:

selenium.common.exceptions.SessionNotCreatedException: Message: session not created: Chrome failed to start: exited normally. (session not created: DevToolsActivePort file doesn't exist) (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)

Summary by Sourcery

Added the --no-sandbox option to the Chrome WebDriver configuration in the getChromeVersion method to ensure compatibility with Docker headless environments.

Adding --no-sandbox option in def getChromeVersion(self) needed to run in docker headless.
Copy link

sourcery-ai bot commented Jun 18, 2024

Reviewer's Guide by Sourcery

This pull request adds the --no-sandbox option to the ChromeOptions in the getChromeVersion method to ensure that Chrome can run in a Docker headless environment without crashing. This change has been confirmed to not affect normal operation on Windows.

File-Level Changes

Files Changes
src/browser.py Added --no-sandbox option to ChromeOptions to ensure compatibility with Docker headless environments.

Tips
  • Trigger a new Sourcery review by commenting @sourcery-ai review on the pull request.
  • You can change your review settings at any time by accessing your dashboard:
    • Enable or disable the Sourcery-generated pull request summary or reviewer's guide;
    • Change the review language;
  • You can always contact us if you have any questions or feedback.

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @jdeath - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟡 Security: 1 issue found
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.

@@ -200,7 +200,7 @@ def getCCodeLang(self, lang: str, geo: str) -> tuple:
def getChromeVersion(self) -> str:
chrome_options = ChromeOptions()
chrome_options.add_argument("--headless=new")

chrome_options.add_argument("--no-sandbox")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 issue (security): Consider potential security implications of --no-sandbox.

The --no-sandbox flag can pose security risks as it disables the Chrome sandbox, which is a key security feature. Ensure that this change is necessary and that appropriate security measures are in place.

@klept0 klept0 merged commit 230140e into klept0:master Jun 18, 2024
3 checks passed
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 this pull request may close these issues.

2 participants