Skip to content

Create 自動化 #2311

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

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from
Open

Create 自動化 #2311

wants to merge 1 commit into from

Conversation

kawada3637
Copy link

@kawada3637 kawada3637 commented May 18, 2025

User description

Thanks for contributing to the Selenium site and documentation!
A PR well described will help maintainers to review and merge it quickly

Before submitting your PR, please check our contributing guidelines.
Avoid large PRs, and help reviewers by making them as simple and short as possible.

Description

Motivation and Context

Types of changes

  • Change to the site (I have double-checked the Netlify deployment, and my changes look good)
  • Code example added (and I also added the example to all translated languages)
  • Improved translation
  • Added new translation (and I also added a notice to each document missing translation)

Checklist

  • I have read the contributing document.
  • I have used hugo to render the site/docs locally and I am sure it works.

PR Type

enhancement


Description

  • Added a new Python Selenium automation script example.

  • Demonstrates login button interaction on a specific website.

  • Includes browser setup, navigation, and cleanup steps.


Changes walkthrough 📝

Relevant files
Enhancement
自動化
New Selenium Python script for automated login example     

examples/python/自動化

  • Introduced a new Python script for Selenium automation.
  • Script navigates to a website and clicks the login button.
  • Provides browser setup, wait times, and cleanup.
  • Contains comments for customization and further steps.
  • +26/-0   

    Need help?
  • Type /help how to ... in the comments thread for any questions about Qodo Merge usage.
  • Check out the documentation for more information.
  • Copy link

    netlify bot commented May 18, 2025

    👷 Deploy request for selenium-dev pending review.

    Visit the deploys page to approve it

    Name Link
    🔨 Latest commit dd87b8d

    @CLAassistant
    Copy link

    CLA assistant check
    Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
    You have signed the CLA already but the status is still pending? Let us recheck it.

    Copy link
    Contributor

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
    🧪 No relevant tests
    🔒 Security concerns

    Sensitive information exposure:
    The script contains a URL to what appears to be a private recruitment management system (https://airwork.recruit.co.jp/). This could potentially expose internal systems or workflows that shouldn't be publicly documented. The script should use generic, public websites for examples instead.

    ⚡ Recommended focus areas for review

    Hardcoded Credentials

    The script contains a hardcoded URL to a specific recruitment management system (Airワーク採用管理). This appears to be a private/internal system rather than a generic example appropriate for public documentation.

    # Airワーク採用管理のログインページにアクセス
    driver.get("https://airwork.recruit.co.jp/")  # URLを正確に入力してください
    Improper File Naming

    The file name is in Japanese (自動化) which means "automation". Example files should follow consistent naming conventions with descriptive English names and proper extensions (.py).

    from selenium import webdriver
    from selenium.webdriver.common.by import By
    Hardcoded Path

    The script contains a hardcoded path to chromedriver that would not work across different environments. Example code should use more portable approaches or clearly indicate placeholder values.

    # ChromeDriverのパス(適宜変更してください)
    service = Service(executable_path="/path/to/chromedriver")

    Copy link
    Contributor

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Impact
    Possible issue
    Use explicit waits

    Add explicit waits instead of implicit sleep to ensure the login button is
    present before attempting to click it. This makes the automation more robust
    against timing issues.

    examples/python/自動化 [18-20]

    +from selenium.webdriver.support.ui import WebDriverWait
    +from selenium.webdriver.support import expected_conditions as EC
    +
     # 「ログイン」ボタンをクリック(テキスト一致で取得)
    -login_button = driver.find_element(By.XPATH, "//button[contains(text(), 'ログイン')]")
    +login_button = WebDriverWait(driver, 10).until(
    +    EC.element_to_be_clickable((By.XPATH, "//button[contains(text(), 'ログイン')]"))
    +)
     login_button.click()
    • Apply / Chat
    Suggestion importance[1-10]: 8

    __

    Why: Replacing static sleep with explicit waits significantly improves the reliability of the automation by handling dynamic page loads and reducing flakiness, making this a high-impact improvement.

    Medium
    General
    Add error handling

    Consider using a try-except block around browser operations to handle potential
    exceptions gracefully. This ensures proper cleanup of resources even if errors
    occur during execution.

    examples/python/自動化 [9-13]

    -# ブラウザ起動
    -driver = webdriver.Chrome(service=service)
    +try:
    +    # ブラウザ起動
    +    driver = webdriver.Chrome(service=service)
    +    
    +    # Airワーク採用管理のログインページにアクセス
    +    driver.get("https://airwork.recruit.co.jp/")  # URLを正確に入力してください
    +except Exception as e:
    +    print(f"Error during browser setup: {e}")
    +    driver.quit()
    +    exit(1)
     
    -# Airワーク採用管理のログインページにアクセス
    -driver.get("https://airwork.recruit.co.jp/")  # URLを正確に入力してください
    -
    • Apply / Chat
    Suggestion importance[1-10]: 7

    __

    Why: Adding a try-except block for browser operations improves robustness and ensures resources are cleaned up in case of errors, but this is a standard error handling improvement rather than a critical bug fix.

    Medium
    • More

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

    Successfully merging this pull request may close these issues.

    2 participants