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 examples for drivers http_client in java and python #2041

Open
wants to merge 3 commits into
base: trunk
Choose a base branch
from

Conversation

VietND96
Copy link
Member

@VietND96 VietND96 commented Nov 5, 2024

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, tests


Description

  • Added examples and tests for HTTP client configuration in both Java and Python.
  • Introduced fixtures and methods to start Selenium grid servers with SSL and authentication.
  • Updated documentation to include new Python example references.
  • Added TLS certificate and key files for testing purposes.
  • Updated Python requirements to include the requests library.

Changes walkthrough 📝

Relevant files
Enhancement
2 files
conftest.py
Add Selenium grid server fixture and resource path function

examples/python/tests/conftest.py

  • Added requests and HTTPBasicAuth imports.
  • Introduced _get_resource_path function for file path resolution.
  • Added grid_server fixture to start and manage a Selenium server.
  • +87/-0   
    BaseTest.java
    Enhance BaseTest with advanced grid start method                 

    examples/java/src/test/java/dev/selenium/BaseTest.java

  • Added fields for username, password, and trustStorePassword.
  • Introduced startStandaloneGridAdvanced method with SSL configuration.
  • +36/-0   
    Tests
    2 files
    test_http_client.py
    Add tests for remote WebDriver with client config               

    examples/python/tests/drivers/test_http_client.py

  • Added tests for starting remote WebDriver with client configuration.
  • Utilized grid_server fixture for test setup.
  • Implemented proxy and client configuration in tests.
  • +53/-0   
    HttpClientTest.java
    Add HttpClient tests with SSL and authentication                 

    examples/java/src/test/java/dev/selenium/drivers/HttpClientTest.java

  • Added tests for RemoteWebDriver with client configuration.
  • Implemented SSL context creation methods.
  • Configured tests to authenticate and manage SSL.
  • +105/-0 
    Miscellaneous
    4 files
    tls.crt
    Add TLS certificate for Java tests                                             

    examples/java/src/test/resources/tls.crt

    • Added TLS certificate file for testing.
    +24/-0   
    tls.key
    Add TLS private key for Java tests                                             

    examples/java/src/test/resources/tls.key

    • Added TLS private key file for testing.
    +28/-0   
    tls.crt
    Add TLS certificate for Python tests                                         

    examples/python/tests/resources/tls.crt

    • Added TLS certificate file for Python tests.
    +24/-0   
    tls.key
    Add TLS private key for Python tests                                         

    examples/python/tests/resources/tls.key

    • Added TLS private key file for Python tests.
    +28/-0   
    Dependencies
    1 files
    requirements.txt
    Update Python requirements with requests library                 

    examples/python/requirements.txt

    • Added requests library to requirements.
    +1/-0     
    Documentation
    1 files
    http_client.en.md
    Update Python code block in documentation                               

    website_and_docs/content/documentation/webdriver/drivers/http_client.en.md

    • Updated Python example code block reference.
    +1/-1     

    💡 PR-Agent usage: Comment /help "your question" on any pull request to receive relevant information

    Copy link
    Contributor

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 4 🔵🔵🔵🔵⚪
    🧪 PR contains tests
    🔒 Security concerns

    Sensitive information exposure:
    The PR introduces hardcoded credentials and SSL certificates in both Python and Java test files. While these are likely intended for testing purposes, it's important to ensure that such sensitive information is not accidentally committed to version control or deployed to production environments. Consider using environment variables or a secure secret management system to handle these credentials and certificates.

    SSL verification bypass: The Java test file includes a method createIgnoreSSLContext that creates a trust manager accepting all certificates without verification. This practice can lead to security vulnerabilities if used in production code, as it bypasses SSL certificate validation, potentially allowing man-in-the-middle attacks.

    ⚡ Recommended focus areas for review

    Security Concern
    The grid_server fixture uses hardcoded credentials. Consider using environment variables or a secure secret management system for sensitive information.

    Security Concern
    Hardcoded credentials and trust store password are used. Consider using environment variables or a secure secret management system for sensitive information.

    Security Vulnerability
    The createIgnoreSSLContext method creates a trust manager that accepts all certificates without verification. This can lead to security vulnerabilities in production environments.

    Copy link

    netlify bot commented Nov 5, 2024

    Deploy Preview for selenium-dev ready!

    Name Link
    🔨 Latest commit a5d1955
    🔍 Latest deploy log https://app.netlify.com/sites/selenium-dev/deploys/6729ce649798ed0008d32b9e
    😎 Deploy Preview https://deploy-preview-2041--selenium-dev.netlify.app
    📱 Preview on mobile
    Toggle QR Code...

    QR Code

    Use your smartphone camera to open QR code link.

    To edit notification comments on pull requests, go to your Netlify site configuration.

    Copy link
    Contributor

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Score
    Best practice
    Use a context manager for subprocess to ensure proper cleanup

    Use a context manager to ensure proper cleanup of the Selenium server process.

    examples/python/tests/conftest.py [303-325]

    -process = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    +with subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE) as process:
    +    def wait_for_server(url, timeout=60):
    +        start = time.time()
    +        while time.time() - start < timeout:
    +            try:
    +                requests.get(url, verify=_path_cert, auth=HTTPBasicAuth(_username, _password))
    +                return True
    +            except OSError as e:
    +                print(e)
    +                time.sleep(0.2)
    +        return False
     
    -def wait_for_server(url, timeout=60):
    -    start = time.time()
    -    while time.time() - start < timeout:
    -        try:
    -            requests.get(url, verify=_path_cert, auth=HTTPBasicAuth(_username, _password))
    -            return True
    -        except OSError as e:
    -            print(e)
    -            time.sleep(0.2)
    -    return False
    +    if not wait_for_server(f"https://{_host}:{_port}/status"):
    +        raise RuntimeError(f"Selenium server did not start within the allotted time.")
     
    -if not wait_for_server(f"https://{_host}:{_port}/status"):
    -    raise RuntimeError(f"Selenium server did not start within the allotted time.")
    +    yield f"https://{_host}:{_port}"
     
    -yield f"https://{_host}:{_port}"
    +    process.terminate()
    +    try:
    +        process.wait(timeout=10)
    +    except subprocess.TimeoutExpired:
    +        process.kill()
     
    -process.terminate()
    -try:
    -    process.wait(timeout=10)
    -except subprocess.TimeoutExpired:
    -    process.kill()
    -
    • Apply this suggestion
    Suggestion importance[1-10]: 7

    Why: Using a context manager ensures proper cleanup of resources, even if an exception occurs. This improves code reliability and resource management.

    7
    Use a more specific exception type for better error handling

    Consider using a more specific exception type instead of a broad Exception in the
    except clause.

    examples/python/tests/drivers/test_http_client.py [309-311]

    -except Exception as e:
    +except requests.RequestException as e:
         print(e)
         time.sleep(0.2)
    • Apply this suggestion
    Suggestion importance[1-10]: 5

    Why: Using a more specific exception type (requests.RequestException) improves error handling and makes the code more robust and easier to debug.

    5
    Maintainability
    Extract common configuration setup to reduce code duplication

    Consider extracting the common configuration setup into a separate method to reduce
    code duplication.

    examples/java/src/test/java/dev/selenium/drivers/HttpClientTest.java [40-46]

    -ClientConfig clientConfig = ClientConfig.defaultConfig()
    -        .withRetries()
    -        .sslContext(createSSLContextWithCA(Path.of("src/test/resources/tls.crt").toAbsolutePath().toString()))
    -        .connectionTimeout(Duration.ofSeconds(300))
    -        .readTimeout(Duration.ofSeconds(3600))
    -        .authenticateAs(new UsernameAndPassword("admin", "myStrongPassword"))
    -        .version(HTTP_1_1.toString());
    +private ClientConfig createCommonClientConfig(SSLContext sslContext) {
    +    return ClientConfig.defaultConfig()
    +            .withRetries()
    +            .sslContext(sslContext)
    +            .connectionTimeout(Duration.ofSeconds(300))
    +            .readTimeout(Duration.ofSeconds(3600))
    +            .authenticateAs(new UsernameAndPassword("admin", "myStrongPassword"))
    +            .version(HTTP_1_1.toString());
    +}
     
    +// Usage in tests:
    +ClientConfig clientConfig = createCommonClientConfig(createSSLContextWithCA(Path.of("src/test/resources/tls.crt").toAbsolutePath().toString()));
    +
    • Apply this suggestion
    Suggestion importance[1-10]: 6

    Why: Extracting common configuration setup reduces code duplication, improving maintainability and readability of the test class.

    6
    Use a constant for the TLS certificate file path to improve maintainability

    Consider using a constant for the path to the TLS certificate file to improve
    maintainability.

    examples/java/src/test/java/dev/selenium/drivers/HttpClientTest.java [42]

    -Path.of("src/test/resources/tls.crt").toAbsolutePath().toString()
    +private static final String TLS_CERT_PATH = "src/test/resources/tls.crt";
    +// ...
    +Path.of(TLS_CERT_PATH).toAbsolutePath().toString()
    Suggestion importance[1-10]: 4

    Why: Using a constant for the TLS certificate file path improves maintainability by centralizing the path definition, making it easier to update if needed.

    4

    💡 Need additional feedback ? start a PR chat

    Copy link
    Contributor

    codiumai-pr-agent-pro bot commented Nov 5, 2024

    CI Failure Feedback 🧐

    (Checks updated until commit a5d1955)

    Action: tests (macos, stable)

    Failed stage: Run tests [❌]

    Failed test name: test_basic_options

    Failure summary:

    The action failed due to two test failures in the file tests/browsers/test_safari.py:

  • test_basic_options failed with a TypeError because the init method of SafariRemoteConnection was
    called without the required positional argument remote_server_addr.
  • test_enable_logging also failed with the same TypeError for the same reason.
    These errors indicate a
    problem with the instantiation of the Safari WebDriver, likely due to incorrect or missing
    configuration for the remote_server_addr parameter.

  • Relevant error logs:
    1:  ##[group]Operating System
    2:  macOS
    ...
    
    152:  Installing collected packages: pip
    153:  Successfully installed pip-24.3.1
    154:  Install OpenSSL certificates
    155:  Collecting certifi
    156:  Using cached certifi-2024.8.30-py3-none-any.whl.metadata (2.2 kB)
    157:  Using cached certifi-2024.8.30-py3-none-any.whl (167 kB)
    158:  Installing collected packages: certifi
    159:  Successfully installed certifi-2024.8.30
    160:  ##[error][notice] A new release of pip is available: 21.1.1 -> 24.3.1
    ...
    
    316:  timeout_minutes: 40
    317:  max_attempts: 3
    318:  command: cd examples/python
    319:  pytest
    320:  
    321:  retry_wait_seconds: 10
    322:  polling_interval_seconds: 1
    323:  warning_on_retry: true
    324:  continue_on_error: false
    ...
    
    361:  tests/elements/test_file_upload.py .                                     [ 77%]
    362:  tests/interactions/test_alerts.py ...                                    [ 79%]
    363:  tests/interactions/test_print_options.py .......                         [ 84%]
    364:  tests/interactions/test_prints_page.py .                                 [ 85%]
    365:  tests/interactions/test_virtual_authenticator.py ..........              [ 93%]
    366:  tests/support/test_select_list.py ...                                    [ 95%]
    367:  tests/troubleshooting/test_logging.py .                                  [ 96%]
    368:  tests/waits/test_waits.py .....                                          [100%]
    369:  =================================== FAILURES ===================================
    370:  ______________________________ test_basic_options ______________________________
    371:  @pytest.mark.skipif(sys.platform != "darwin", reason="requires Mac")
    372:  def test_basic_options():
    373:  options = webdriver.SafariOptions()
    374:  >       driver = webdriver.Safari(options=options)
    375:  tests/browsers/test_safari.py:10: 
    376:  _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
    377:  self = <[AttributeError("'WebDriver' object has no attribute 'session_id'") raised in repr()] WebDriver object at 0x10703c310>
    ...
    
    397:  self.service.path = self.service.env_path() or DriverFinder(self.service, options).get_driver_path()
    398:  if not self.service.reuse_service:
    399:  self.service.start()
    400:  client_config = ClientConfig(remote_server_addr=self.service.service_url, keep_alive=keep_alive, timeout=120)
    401:  >       executor = SafariRemoteConnection(
    402:  ignore_proxy=options._ignore_local_proxy,
    403:  client_config=client_config,
    404:  )
    405:  E       TypeError: __init__() missing 1 required positional argument: 'remote_server_addr'
    406:  /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/selenium/webdriver/safari/webdriver.py:55: TypeError
    407:  _____________________________ test_enable_logging ______________________________
    408:  @pytest.mark.skipif(sys.platform != "darwin", reason="requires Mac")
    409:  def test_enable_logging():
    410:  service = webdriver.SafariService(service_args=["--diagnose"])
    411:  >       driver = webdriver.Safari(service=service)
    412:  tests/browsers/test_safari.py:19: 
    413:  _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
    414:  self = <[AttributeError("'WebDriver' object has no attribute 'session_id'") raised in repr()] WebDriver object at 0x10701acd0>
    ...
    
    434:  self.service.path = self.service.env_path() or DriverFinder(self.service, options).get_driver_path()
    435:  if not self.service.reuse_service:
    436:  self.service.start()
    437:  client_config = ClientConfig(remote_server_addr=self.service.service_url, keep_alive=keep_alive, timeout=120)
    438:  >       executor = SafariRemoteConnection(
    439:  ignore_proxy=options._ignore_local_proxy,
    440:  client_config=client_config,
    441:  )
    442:  E       TypeError: __init__() missing 1 required positional argument: 'remote_server_addr'
    443:  /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/selenium/webdriver/safari/webdriver.py:55: TypeError
    ...
    
    457:  tests/drivers/test_http_client.py:12
    458:  /Users/runner/work/seleniumhq.github.io/seleniumhq.github.io/examples/python/tests/drivers/test_http_client.py:12: PytestUnknownMarkWarning: Unknown pytest.mark.sanity - is this a typo?  You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
    459:  @pytest.mark.sanity
    460:  tests/drivers/test_http_client.py:29
    461:  /Users/runner/work/seleniumhq.github.io/seleniumhq.github.io/examples/python/tests/drivers/test_http_client.py:29: PytestUnknownMarkWarning: Unknown pytest.mark.sanity - is this a typo?  You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
    462:  @pytest.mark.sanity
    463:  -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
    464:  =========================== short test summary info ============================
    465:  FAILED tests/browsers/test_safari.py::test_basic_options - TypeError: __init__() missing 1 required positional argument: 'remote_server_addr'
    466:  FAILED tests/browsers/test_safari.py::test_enable_logging - TypeError: __init__() missing 1 required positional argument: 'remote_server_addr'
    467:  ======= 2 failed, 124 passed, 7 skipped, 6 warnings in 237.48s (0:03:57) =======
    468:  ##[warning]Attempt 1 failed. Reason: Child_process exited with error code 1
    ...
    
    493:  tests/elements/test_file_upload.py .                                     [ 77%]
    494:  tests/interactions/test_alerts.py ...                                    [ 79%]
    495:  tests/interactions/test_print_options.py .......                         [ 84%]
    496:  tests/interactions/test_prints_page.py .                                 [ 85%]
    497:  tests/interactions/test_virtual_authenticator.py ..........              [ 93%]
    498:  tests/support/test_select_list.py ...                                    [ 95%]
    499:  tests/troubleshooting/test_logging.py .                                  [ 96%]
    500:  tests/waits/test_waits.py .....                                          [100%]
    501:  =================================== FAILURES ===================================
    502:  ______________________________ test_basic_options ______________________________
    503:  @pytest.mark.skipif(sys.platform != "darwin", reason="requires Mac")
    504:  def test_basic_options():
    505:  options = webdriver.SafariOptions()
    506:  >       driver = webdriver.Safari(options=options)
    507:  tests/browsers/test_safari.py:10: 
    508:  _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
    509:  self = <[AttributeError("'WebDriver' object has no attribute 'session_id'") raised in repr()] WebDriver object at 0x103830520>
    ...
    
    529:  self.service.path = self.service.env_path() or DriverFinder(self.service, options).get_driver_path()
    530:  if not self.service.reuse_service:
    531:  self.service.start()
    532:  client_config = ClientConfig(remote_server_addr=self.service.service_url, keep_alive=keep_alive, timeout=120)
    533:  >       executor = SafariRemoteConnection(
    534:  ignore_proxy=options._ignore_local_proxy,
    535:  client_config=client_config,
    536:  )
    537:  E       TypeError: __init__() missing 1 required positional argument: 'remote_server_addr'
    538:  /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/selenium/webdriver/safari/webdriver.py:55: TypeError
    539:  _____________________________ test_enable_logging ______________________________
    540:  @pytest.mark.skipif(sys.platform != "darwin", reason="requires Mac")
    541:  def test_enable_logging():
    542:  service = webdriver.SafariService(service_args=["--diagnose"])
    543:  >       driver = webdriver.Safari(service=service)
    544:  tests/browsers/test_safari.py:19: 
    545:  _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
    546:  self = <[AttributeError("'WebDriver' object has no attribute 'session_id'") raised in repr()] WebDriver object at 0x10380a8b0>
    ...
    
    566:  self.service.path = self.service.env_path() or DriverFinder(self.service, options).get_driver_path()
    567:  if not self.service.reuse_service:
    568:  self.service.start()
    569:  client_config = ClientConfig(remote_server_addr=self.service.service_url, keep_alive=keep_alive, timeout=120)
    570:  >       executor = SafariRemoteConnection(
    571:  ignore_proxy=options._ignore_local_proxy,
    572:  client_config=client_config,
    573:  )
    574:  E       TypeError: __init__() missing 1 required positional argument: 'remote_server_addr'
    575:  /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/selenium/webdriver/safari/webdriver.py:55: TypeError
    ...
    
    589:  tests/drivers/test_http_client.py:12
    590:  /Users/runner/work/seleniumhq.github.io/seleniumhq.github.io/examples/python/tests/drivers/test_http_client.py:12: PytestUnknownMarkWarning: Unknown pytest.mark.sanity - is this a typo?  You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
    591:  @pytest.mark.sanity
    592:  tests/drivers/test_http_client.py:29
    593:  /Users/runner/work/seleniumhq.github.io/seleniumhq.github.io/examples/python/tests/drivers/test_http_client.py:29: PytestUnknownMarkWarning: Unknown pytest.mark.sanity - is this a typo?  You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
    594:  @pytest.mark.sanity
    595:  -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
    596:  =========================== short test summary info ============================
    597:  FAILED tests/browsers/test_safari.py::test_basic_options - TypeError: __init__() missing 1 required positional argument: 'remote_server_addr'
    598:  FAILED tests/browsers/test_safari.py::test_enable_logging - TypeError: __init__() missing 1 required positional argument: 'remote_server_addr'
    599:  ======= 2 failed, 124 passed, 7 skipped, 6 warnings in 264.12s (0:04:24) =======
    600:  ##[warning]Attempt 2 failed. Reason: Child_process exited with error code 1
    ...
    
    625:  tests/elements/test_file_upload.py .                                     [ 77%]
    626:  tests/interactions/test_alerts.py ...                                    [ 79%]
    627:  tests/interactions/test_print_options.py .......                         [ 84%]
    628:  tests/interactions/test_prints_page.py .                                 [ 85%]
    629:  tests/interactions/test_virtual_authenticator.py ..........              [ 93%]
    630:  tests/support/test_select_list.py ...                                    [ 95%]
    631:  tests/troubleshooting/test_logging.py .                                  [ 96%]
    632:  tests/waits/test_waits.py .....                                          [100%]
    633:  =================================== FAILURES ===================================
    634:  ______________________________ test_basic_options ______________________________
    635:  @pytest.mark.skipif(sys.platform != "darwin", reason="requires Mac")
    636:  def test_basic_options():
    637:  options = webdriver.SafariOptions()
    638:  >       driver = webdriver.Safari(options=options)
    639:  tests/browsers/test_safari.py:10: 
    640:  _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
    641:  self = <[AttributeError("'WebDriver' object has no attribute 'session_id'") raised in repr()] WebDriver object at 0x10717a610>
    ...
    
    661:  self.service.path = self.service.env_path() or DriverFinder(self.service, options).get_driver_path()
    662:  if not self.service.reuse_service:
    663:  self.service.start()
    664:  client_config = ClientConfig(remote_server_addr=self.service.service_url, keep_alive=keep_alive, timeout=120)
    665:  >       executor = SafariRemoteConnection(
    666:  ignore_proxy=options._ignore_local_proxy,
    667:  client_config=client_config,
    668:  )
    669:  E       TypeError: __init__() missing 1 required positional argument: 'remote_server_addr'
    670:  /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/selenium/webdriver/safari/webdriver.py:55: TypeError
    671:  _____________________________ test_enable_logging ______________________________
    672:  @pytest.mark.skipif(sys.platform != "darwin", reason="requires Mac")
    673:  def test_enable_logging():
    674:  service = webdriver.SafariService(service_args=["--diagnose"])
    675:  >       driver = webdriver.Safari(service=service)
    676:  tests/browsers/test_safari.py:19: 
    677:  _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
    678:  self = <[AttributeError("'WebDriver' object has no attribute 'session_id'") raised in repr()] WebDriver object at 0x10711c5b0>
    ...
    
    698:  self.service.path = self.service.env_path() or DriverFinder(self.service, options).get_driver_path()
    699:  if not self.service.reuse_service:
    700:  self.service.start()
    701:  client_config = ClientConfig(remote_server_addr=self.service.service_url, keep_alive=keep_alive, timeout=120)
    702:  >       executor = SafariRemoteConnection(
    703:  ignore_proxy=options._ignore_local_proxy,
    704:  client_config=client_config,
    705:  )
    706:  E       TypeError: __init__() missing 1 required positional argument: 'remote_server_addr'
    707:  /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/selenium/webdriver/safari/webdriver.py:55: TypeError
    ...
    
    721:  tests/drivers/test_http_client.py:12
    722:  /Users/runner/work/seleniumhq.github.io/seleniumhq.github.io/examples/python/tests/drivers/test_http_client.py:12: PytestUnknownMarkWarning: Unknown pytest.mark.sanity - is this a typo?  You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
    723:  @pytest.mark.sanity
    724:  tests/drivers/test_http_client.py:29
    725:  /Users/runner/work/seleniumhq.github.io/seleniumhq.github.io/examples/python/tests/drivers/test_http_client.py:29: PytestUnknownMarkWarning: Unknown pytest.mark.sanity - is this a typo?  You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
    726:  @pytest.mark.sanity
    727:  -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
    728:  =========================== short test summary info ============================
    729:  FAILED tests/browsers/test_safari.py::test_basic_options - TypeError: __init__() missing 1 required positional argument: 'remote_server_addr'
    730:  FAILED tests/browsers/test_safari.py::test_enable_logging - TypeError: __init__() missing 1 required positional argument: 'remote_server_addr'
    731:  ======= 2 failed, 124 passed, 7 skipped, 6 warnings in 263.16s (0:04:23) =======
    732:  ##[error]Final attempt failed. Child_process exited with error code 1
    

    ✨ CI feedback usage guide:

    The CI feedback tool (/checks) automatically triggers when a PR has a failed check.
    The tool analyzes the failed checks and provides several feedbacks:

    • Failed stage
    • Failed test name
    • Failure summary
    • Relevant error logs

    In addition to being automatically triggered, the tool can also be invoked manually by commenting on a PR:

    /checks "https://github.com/{repo_name}/actions/runs/{run_number}/job/{job_number}"
    

    where {repo_name} is the name of the repository, {run_number} is the run number of the failed check, and {job_number} is the job number of the failed check.

    Configuration options

    • enable_auto_checks_feedback - if set to true, the tool will automatically provide feedback when a check is failed. Default is true.
    • excluded_checks_list - a list of checks to exclude from the feedback, for example: ["check1", "check2"]. Default is an empty list.
    • enable_help_text - if set to true, the tool will provide a help message with the feedback. Default is true.
    • persistent_comment - if set to true, the tool will overwrite a previous checks comment with the new feedback. Default is true.
    • final_update_message - if persistent_comment is true and updating a previous checks message, the tool will also create a new message: "Persistent checks updated to latest commit". Default is true.

    See more information about the checks tool in the docs.

    @VietND96 VietND96 force-pushed the example-http-client branch 6 times, most recently from b52ac53 to ea3d5f0 Compare November 5, 2024 03:17
    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.

    1 participant