Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Michael Mintz
    @mdmintz
    @mpolynskyi Unless you're using pytest-ordering, it's alphabetical, so most likely that'll be the last test run of that class. For running tests that reuse a browser session, if you ever close the original reused browser, it'll just open up a new one for the next test and tests after that will reuse it. (For recent versions of SeleniumBase)
    mpolynskyi
    @mpolynskyi
    great, thanks!
    Michael Mintz
    @mdmintz
    Version 1.59.6 has been released. The main part is that it updates Firefox WebDriver settings on Linux for better compatibility there. It also updates a few Python dependencies to keep things up-to-date.
    vutuanlinh2k2
    @vutuanlinh2k2
    Hello @mdmintz, I want to know that in order to use the drag_and_drop function, does the "drag element" have to have attribute 'draggable' set to "true" ?
    Michael Mintz
    @mdmintz
    Hi @vutuanlinh2k2 the drag_and_drop() function simulates a mouse_down over the first element, and a mouse_up over the second element. It's up to the website itself to determine if that is enough to trigger the action.
    vutuanlinh2k2
    @vutuanlinh2k2
    Ok thanks @mdmintz !
    Mila Bogdan
    @ludvig1379

    Hi @ludvig1379 , you'll need to know the connection string for that cloud, and you'll need to know which desired capabilities are supported. Examples here: https://seleniumbase.io/help_docs/desired_capabilities/

    Thank you @mdmintz and have a good day :)

    srihari2812
    @srihari2812
    Hey @mdmintz , is there any function/method to assert all the elements of a webpage at once? instead of asserting individual elements
    Michael Mintz
    @mdmintz
    @srihari2812 You mean an assert statement that takes a list of elements instead of doing one assert per line? Not yet. Could be a fun feature request.
    Peak
    @pattarika
    Hi @mdmintz, can I use login as part of the setup if I choose to use sb fixture?
    or do I have to go back and use "class BaseTestCase(BaseCase):" way?
    Michael Mintz
    @mdmintz
    @pattarika For overriding setUp(), you'll need to use the class BaseTestCase(BaseCase): way.
    Peak
    @pattarika
    Thanks for the confirmation :)
    Peak
    @pattarika
    image.png
    2 replies
    I have to click an image based on label that's ID number is dynamically generated based on login user. Can I use css selector for this?
    Peak
    @pattarika
    since I can't use sb and need to go back to class BaseTestCase(BaseCase), does it mean I won't be able to user conftest and need to go back to supply bind variable via --data tag?
    Michael Mintz
    @mdmintz
    Try :contains("Grant Time & Effort")
    for the selector. @pattarika
    If you really need conftest, you can use one if you update the pytest.ini file
    10 replies
    And the --data=DATA is always an option.
    Peak
    @pattarika
    sb.click_link_text(':contains("Grant Time & Effort")') ? do not see sample from https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/method_summary.md
    Michael Mintz
    @mdmintz
    Just a regular click() @pattarika
    3 replies
    Michael Mintz
    @mdmintz
    SeleniumBase 1.60.0 is available on GitHub and PyPI.
    srihari2812
    @srihari2812
    Hii @mdmintz , small suggestion for assertions in POM . We generally maintain locators of elements of page in objects.py , why don't we have a method like assert_page which imports all the elements declared in objects.py ,asserts the elements once and give the result.. instead of writing multiple lines of code.
    @mdmintz, i am unable to use env variables in test files .. it is returning None value. is there any specific directory to create env file??
    Michael Mintz
    @mdmintz
    @srihari2812 Which env files are you talking about? It's Python, so you can create your own files and import them.
    You can also import your own page objects from page object files.
    taylorm
    @taylorm:matrix.org
    [m]
    Hello! My team is implementing SeleniumBase and we use Gridlastic for managing our Selenium Grid. I have a bit of a unique situation, in that my primary source of internet is an AT&T cellular hotspot. When attempting to use the grid and SeleniumBase, if a grid node is not already spun up and available the test will fail on my AT&T connection. We have narrowed it down to it being that my connection is using UDP (when I use a VPN set to UDP I get the failure, but using a VPN set to TCP the tests pass in this scenario). My question to you all is this: Is there a way to specify in SeleniumBase or PyTest to only use TCP?
    Michael Mintz
    @mdmintz
    Hi @taylorm:matrix.org Does the same situation occur when using a regular Selenium Grid? There's a ReadMe here: https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/utilities/selenium_grid/ReadMe.md (It's possible your situation is related to Gridlastic)
    taylorm
    @taylorm:matrix.org
    [m]
    I didn't want to spin up a remote grid server only to test this, and spinning one up on my local machine obviously wouldn't test varying network conditions. For anyone curious, I decided to code remotely via VS Code connected to an AWS instance, which will avoid issues in my particular situation as all the tests will be initiated from that instance instead of my machine with my less-than-perfect connection. Idea from https://pub.towardsai.net/how-to-do-remote-development-with-vs-code-using-aws-ssm-415881d249f3
    Myles Steinhauser
    @masteinhauser
    hello @mdmintz! I was thinking ahead to the Selenium 4 release, and I didn't see anything setup to track that publicly. Do you have anything available for interested teams to monitor, or will you start sharing info here or elsewhere?
    Michael Mintz
    @mdmintz
    Hi @masteinhauser , the plan is to upgrade SeleniumBase to Selenium 4 once the official release is out. It is still in Beta. I have already made the necessary changes that will be needed.
    Michael Mintz
    @mdmintz
    https://github.com/seleniumbase/SeleniumBase/releases/tag/v1.61.0 has been released! (The biggest update is that you can now run parallel tests when using the Dashboard.)
    mpolynskyi
    @mpolynskyi
    So, to assert value in input I can't use self.assert_text(text, selector), and have to use assert self.get_attribute(selector, 'value') == text ?
    mpolynskyi
    @mpolynskyi
    it works, but maybe there is already method for this in seleniumbase?
    Michael Mintz
    @mdmintz
    @mpolynskyi normally one types text into a text field, not extracts/asserts text from it. But if your solution works, then you've found the right method for it. :)
    taylorm
    @taylorm:matrix.org
    [m]
    @mdmintz: is there any plan to add deviceName to the mobile emulation options? e.g. https://chromedriver.chromium.org/mobile-emulation
    taylorm
    @taylorm:matrix.org
    [m]
    Perhaps something like this replaced into seleniumbase/core/browser_launcher.py would work, with updating affected functions of course. https://github.com/seleniumbase/SeleniumBase/blob/f781e982445bd3f699e009cb2bd7aab890f3b0c9/seleniumbase/core/browser_launcher.py#L182-L196
    if mobile_emulator:
        emulator_settings = {}
        # If device_name is provided, simply pass in that
        if device_name:
            mobile_emulation = { "deviceName": device_name }
        # If device_name is not provided, pass in device_width, device_height, device_pixel_ratio, and user_agent
        else:
            device_metrics = {}
            if type(device_width) is int and type(device_height) is int and (
                    type(device_pixel_ratio) is int):
                device_metrics["width"] = device_width
                device_metrics["height"] = device_height
                device_metrics["pixelRatio"] = device_pixel_ratio
            else:
                device_metrics["width"] = 411
                device_metrics["height"] = 731
                device_metrics["pixelRatio"] = 3
            emulator_settings["deviceMetrics"] = device_metrics
            if user_agent:
                emulator_settings["userAgent"] = user_agent
    :point_up: Edit: @mdmintz: is there any plan to add deviceName to the mobile emulation options? We have a large suite of tests that use the device name as a marker and pass that into chrome, so this would make SeleniumBase more of a drop-in solution for us to switch to. For official documentation see: https://chromedriver.chromium.org/mobile-emulation
    Michael Mintz
    @mdmintz
    @taylorm:matrix.org Let me take a look. For the moment, you can set the device by specifying a user agent string with mobile device metrics.
    Selenium 4 is just around the corner, and will likely have a much updated version of device switching, given the new grid. I may wait for that to add a device name as an option, unless the existing list is good enough. (Given that the last official version of Selenium 3 was 2 years ago, it might be out-of-date.)
    I'm hoping to switch the version of Selenium used from 3 to 4 as soon as the official release is ready.
    taylorm
    @taylorm:matrix.org
    [m]
    That's reasonable. I haven't looked into how this in particular might change in 3 -> 4.
    Michael Mintz
    @mdmintz
    @taylorm:matrix.org For the moment, does a combination of user agent and device metrics get the job done for you?
    (Those can be set on the command line)
    taylorm
    @taylorm:matrix.org
    [m]
    I have looked and understand how the device metrics part works in SB. Since we already have many tests set up using the "device", we were hoping we could simply pass that through to SB, but without it I figured that I could simply wrap what we have and provide the metrics to SB.