Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Peter Nguyen Tr
    @PeterNgTr
    hi, I'm trying to use the selenium grid when running tests.
    I'm following the guide here: https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/utilities/selenium_grid/ReadMe.md
    selenium grid is up:
     [SUCCESS] Selenium-WebDriver Grid Hub started successfully.
    
    Grid Hub console: http://127.0.0.1:4444/grid/console
    when starting the test pytest -k 'test_C5764_Quantity_assertion' --server=127.0.0.1 --port=4444
    it draws the error
    tests/commons/base.py:72: in setUp
        super(BaseTestCase, self).setUp()
    venv/lib/python3.7/site-packages/seleniumbase/fixtures/base_case.py:3267: in setUp
        disable_csp=self.disable_csp)
    venv/lib/python3.7/site-packages/seleniumbase/fixtures/base_case.py:2783: in get_new_driver
        disable_csp=disable_csp)
    venv/lib/python3.7/site-packages/seleniumbase/core/browser_launcher.py:277: in get_driver
        proxy_user, proxy_pass, user_agent, cap_file, disable_csp)
    venv/lib/python3.7/site-packages/seleniumbase/core/browser_launcher.py:302: in get_remote_driver
        desired_capabilities=capabilities)
    venv/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py:157: in __init__
        self.start_session(capabilities, browser_profile)
    venv/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py:252: in start_session
        response = self.execute(Command.NEW_SESSION, parameters)
    venv/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py:321: in execute
        self.error_handler.check_response(response)
    Michael Mintz
    @mintzworld_twitter
    Hi @PeterNgTr You also need a Selenium Node when running with the Selenium Grid.
    Peter Nguyen Tr
    @PeterNgTr
    ah, sorry, I missed that part.
    thanks Michael!
    Peter Nguyen Tr
    @PeterNgTr
    seems like we didn't have the possiblity to set prefer window size and send it to cloud service like browserstack, right @mintzworld_twitter?
    Michael Mintz
    @mintzworld_twitter
    Peter Nguyen Tr
    @PeterNgTr
    cool. works like a charm. Thanks!
    Sy
    @symonk
    @mintzworld_twitter was there any updates since v1.23 regarding alerts? our native browser alerts are accepting in a millisecond then saying they arent there for 10 seconds
    Sy
    @symonk
    wait_for_and_accept_alert() isnt playing too nice with our native alerts, its accepting them within 0.1 seconds then complaining they never existed after 10 secs
    Michael Mintz
    @mdmintz
    @symonk
    import time
    from seleniumbase import BaseCase
    
    
    class MyTestClass(BaseCase):
    
        def test_alerts(self):
            self.open("about:blank")
            self.execute_script('window.alert("ALERT!!!")')
            time.sleep(1.2)  # Not needed (lets you see the alert pop up)
            self.wait_for_and_accept_alert()
            time.sleep(0.8)  # Not needed (lets you see the alert go away)
    Works for me
    Michael Mintz
    @mdmintz
    Version 1.30.0 is out! And the next release won't be until at least September.
    Sy
    @symonk
    chromedriver 76 won't work with seleniumbase alerts i guess? they changed alert behaviour in-line with W3C standards
    might need an update
    Michael Mintz
    @mintzworld_twitter
    @symonk Try the chromedriver that gets installed with “seleniumbase install chromedriver”. There may be an issue with the latest one.
    Also, I just got married and am on my honeymoon in Rome. I arrived there today after a 4-hour layover in Amsterdam. Responses will be delayed!
    Sy
    @symonk
    oh congratulations! :) enjoy your holiday will catch up with you after
    Peter Nguyen Tr
    @PeterNgTr
    Wow. Congratulations! I’m going to Roma tomorrow as well.
    Michael Mintz
    @mintzworld_twitter
    Thank you!
    Sy
    @symonk
    W3C compliance doesnt work with alerts as of chromedriver 76 - they are 'ignore and dismiss' by default it seems now, investigating a fix
    Michael Mintz
    @mintzworld_twitter
    @symonk In the latest version of SeleniumBase, which is 1.30.0, “seleniumbase install chromedriver” installs chromedriver 2.44, which works fine with the latest version of chrome with no issues. Also, I’m in Europe right now for my honeymoon (currently getting WiFi at Hard Rock Cafe Mallorca), so I won’t be able to ship changes until August 30th. Try the latest SeleniumBase with “seleniumbase install chromedriver”.
    mdhatrika
    @mdhatrika

    Hello, double_click() stopped working for me, I have upgraded my selenium base recently, The following is the exception I am seeing

    ../../../../venvselenium/lib/python2.7/site-packages/seleniumbase/fixtures/base_case.py:195: in double_click
    actions.perform()
    ../../../../venvselenium/lib/python2.7/site-packages/selenium/webdriver/common/action_chains.py:80: in perform
    self.w3c_actions.perform()
    ../../../../venvselenium/lib/python2.7/site-packages/selenium/webdriver/common/actions/action_builder.py:76: in perform
    self.driver.execute(Command.W3C_ACTIONS, enc)
    ../../../../venvselenium/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py:321: in execute
    self.error_handler.check_response(response)


    self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x105c8f810>
    response = {'status': 404, 'value': '{"value":{"error":"unknown command","message":"(Session info: chrome=76.0.3809.100)","stackt...007fff6d5982a7 _pthread_start + 70\n15 libsystem_pthread.dylib 0x00007fff6d594425 thread_start + 13\n"}}'}

    def check_response(self, response):
        """
        Checks that a JSON response from the WebDriver does not have an error.
    
        :Args:
         - response - The JSON response from the WebDriver server as a dictionary
           object.
    
        :Raises: If the response contains an error message.
        """
        status = response.get('status', None)
        if status is None or status == ErrorCode.SUCCESS:
            return
        value = None
        message = response.get("message", "")
        screen = response.get("screen", "")
        stacktrace = None
        if isinstance(status, int):
            value_json = response.get('value', None)
            if value_json and isinstance(value_json, basestring):
                import json
                try:
                    value = json.loads(value_json)
                    if len(value.keys()) == 1:
                        value = value['value']
                    status = value.get('error', None)
                    if status is None:
                        status = value["status"]
                        message = value["value"]
                        if not isinstance(message, basestring):
                            value = message
                            message = message.get('message')
                    else:
                        message = value.get('message', None)
                except ValueError:
                    pass
    
        exception_class = ErrorInResponseException
        if status in ErrorCode.NO_SUCH_ELEMENT:
            exception_class = NoSuchElementException
        elif status in ErrorCode.NO_SUCH_FRAME:
            exception_class = NoSuchFrameException
        elif status in ErrorCode.NO_SUCH_WINDOW:
            exception_class = NoSuchWindowException
        elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
            exception_class = StaleElementReferenceException
        elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
            exception_class = ElementNotVisibleException
        elif status in ErrorCode.INVALID_ELEMENT_STATE:
            exception_class = InvalidElementStateException
        elif status in ErrorCode.INVALID_SELECTOR \
                or status in ErrorCode.INVALID_XPATH_SELECTOR \
                or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER:
            exception_class = InvalidSelectorException
        elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
            exception_class = ElementNotSelectableException
        elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
            exception_class = ElementNotInteractableException
        elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
            exception_class = I
    Michael Mintz
    @mintzworld_twitter
    @mdhatrika , I’ll look into it at the end of the week. Currently still on my honeymoon in Italy. Will the first click cause a new page to load for you? That would prevent the double click from working properly. And which chromedriver are you using?
    mdhatrika
    @mdhatrika
    Thank you @mintzworld_twitter ,
    Will the first click causes a new page to load for you- no it is not, in my case it was a dropdown with some opens which will open when I double click on it
    Chromedriver- And the chrome driver I am using is ChromeDriver 2.44.609545
    Michael Mintz
    @mintzworld_twitter
    @mdhatrika Sounds like you’re looking for a hover dropdown with a double_click, I think. There’s a hover_click() method. Not yet a hover_double_click() method, but I can add that to the next release if that’s exactly what you’re looking for.
    Peter Nguyen Tr
    @PeterNgTr
    hi all, if the seleniumbase is running as a container, does the assert_downloaded_filework as it runs in local machine?
    Michael Mintz
    @mintzworld_twitter
    @PeterNgTr It should work as long as file downloads work.
    Michael Mintz
    @mdmintz
    I just returned from my honeymoon and am now ready to continue with SeleniumBase updates.
    Michael Mintz
    @mdmintz
    The latest version of seleniumbase is 1.31.1 , and people should start using that. It has important bug-fixes and updates.
    Peter Nguyen Tr
    @PeterNgTr
    Thanks @mdmintz but it’s not working for me unfortunately. The assert is false. :(
    Michael Mintz
    @mdmintz
    @mdhatrika After you upgrade to seleniumbase 1.31.1, use seleniumbase install chromedriver latest if you're using the latest version of Chrome to get those double-click actions working for you.
    @PeterNgTr Did the download succeed? The assert_downloaded_file(FILE_NAME) will only work if that downloaded file is there in the downloaded_files folder.
    Michael Mintz
    @mdmintz
    @symonk In case you didn't see my comments on seleniumbase/SeleniumBase#362 , your issue should be resolved if you upgrade to the latest SeleniumBase (1.31.1) and run seleniumbase install chromedriver latest. Give it a try and let me know.
    Michael Mintz
    @mdmintz
    Version 1.31.2 was released yesterday. Many updates to Demo Mode. Also the assert_no_js_errors() method is updated. Some similarities to the assert_no_404_errors() method.
    mdhatrika
    @mdhatrika
    @mdmintz Thank you
    Scott
    @ub3rpyr0
    @mdmintz I am unable to install drivers using the seleniumbase install chromedriver latest command due to being behind a proxy at my office. Is there a switch I can use to add proxy info for this command, or is it possible to just download the exe and drop it into the appropriate directory?
    Michael Mintz
    @mintzworld_twitter
    Hi @ub3rpyr0 You can download the driver directly to your System PATH. Or the seleniumbase/drivers folder for where you installed SeleniumBase.
    Scott
    @ub3rpyr0
    excellent - I have chromedriver downloaded to the seleniumbase/drivers folder now, just working on executing a copy of the my_first_test.py and getting an error "argparse.ArgumentError: argument --port: conflicting option string: --port"
    i'm not passing a --port argument, just pytest -v my_first_test.py
    Michael Mintz
    @mintzworld_twitter
    @ub3rpyr0 Do you have any other pytest plugins installed that override the port option? You may want to use a Python virtual environment for installing SeleniumBase to prevent conflicts.
    Also, if you have the line number where the stack trace occurred, I can update SeleniumBase so that later versions take conflicting arguments into account.
    Scott
    @ub3rpyr0
    perhaps, will have to check what's going on as I'm not able to run existing test cases that have nothing to do with SeleniumBase that were running yesterday
    Michael Mintz
    @mintzworld_twitter
    @ub3rpyr0 Also, which version of Python are you running? SeleniumBase command line args are defined in https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/plugins/pytest_plugin.py A quick way to avoid the pytest arg conflict would be to uninstall SeleniumBase, create a virtual environment, and reinstall it there.
    Scott
    @ub3rpyr0
    @mintzworld_twitter I'm running 3.7.3, I have uninstalled SeleniumBase, got my existing test suite running again, and in the process of installing SeleniumBase in a virtualenv per the readme :)
    Scott
    @ub3rpyr0
    I'm able to run the example test from venv now - thanks for your help!
    Michael Mintz
    @mintzworld_twitter
    Excellent! :)
    Michael Mintz
    @mdmintz
    SeleniumBase 1.32.0 is available. Looks like I've finally gotten the framework to where I want it to be for video tutorials coming up.