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
    @mintzworld_twitter
    Use self.assert_element(CSS_SELECTOR)
    Everything can be expressed as a CSS_SELECTOR. Right-click -> Inspect , then Right-click -> Copy Selector in Chrome
    peekyIL
    @pattarika
    Thanks!
    peekyIL
    @pattarika
    @Nu
    Hi Michael
    can I pass params[2] into all def test_xxx without calling self.data.split(',') everytime?
    peekyIL
    @pattarika
    def siteurl(self):
        params = self.data.split(',') 
        return params[2]
    
    def pagename(self):
        params = self.data.split(',') 
        return params[3]
    i add those to the base class and able to call self.siteurl() on test_xxx.py that is working...is this the right way?
    Michael Mintz
    @mintzworld_twitter
    @pattarika That’s one way to do it. That what custom setUp() methods are for.
    peekyIL
    @pattarika
    what would be another way :)
    Michael Mintz
    @mintzworld_twitter
    Putting code in a reusable method that you can call at anytime.
    peekyIL
    @pattarika
    That's what I did inside testBase.py and then instead test_xx.py I can call self.siteurl() or self.pagename() is that what you mean by reusable method?
    Michael Mintz
    @mintzworld_twitter
    I just use that term for any method that isn’t the setUp() method, which is only called once at the beginning of the test
    Sy
    @symonk
    @mintzworld_twitter is the only point of unittest.testcase in basecase inheritance to use the built in assertion functions?
    if so, what do you think on making an option that doesnt have that coupling?
    Michael Mintz
    @mintzworld_twitter
    @symonk it’s a lot more than that. Although assertions are a huge part, it’s also for setUp, tearDown, more flexible test auto-discovery, and a lot of organization. You can just use the fixture example to avoid the class inheritance: https://github.com/seleniumbase/SeleniumBase/blob/master/examples/test_sb_fixture.py
    Sy
    @symonk
    i see, the fixture setup is a bit weird, just such a shame to lose the core pytest functionality properly
    could you link me where that 'sb' that is injected in is set?
    Michael Mintz
    @mintzworld_twitter
    @symonk You can also use the format in https://github.com/seleniumbase/SeleniumBase/blob/master/examples/test_usefixtures.py , which you might find more normal.
    And “sb” should be defined in the pytest_plugin in https://github.com/seleniumbase/SeleniumBase/tree/master/seleniumbase/plugins
    Michael Mintz
    @mintzworld_twitter
    For anyone living near New Hampshire, I’m giving a big workshop on SeleniumBase at Granite State Code Camp on November 2nd, sponsored by Microsoft! http://www.granitestatecodecamp.org/schedule
    Sy
    @symonk
    thanks @mintzworld_twitter :) - is there anyway to pass a custom flag that gets registered to chrome options?
    oh damn, it looks like your already adding it on linux (chrome_options.add_argument("--disable-dev-shm-usage") - I must confirm its actually applying
    Sy
    @symonk
    not sure if it applies when using a remote webdriver
    Michael Mintz
    @mintzworld_twitter
    @symonk I’ll take a look at it later today. Let me know if it’s working for you. You can also pass custom desired capabilities when using remote webdriver.
    Sy
    @symonk
    we are using the --cap-file :) its nice, but i wonder can we pass --dev-shm stuff?
    looking at CI logs, it is not specified to the remote driver when launching chrome on the docker box
    Michael Mintz
    @mintzworld_twitter
    I’ll take a look at it. It’s probably just fixing an “if” statement somewhere in the code.
    I’m rolling out anther release in the next 2 days. I can probably add more into it then.
    Sy
    @symonk
    cool :) do you think i could specify this arg in the cap file?
    its just a flag -- so it doesnt have a 'value'
    Michael Mintz
    @mintzworld_twitter
    @symonk I looked at sample desired capabilities from Sauce Labs, BrowserStack, and others. It’s possible that the arg you want to add is already supported. I’d check first. If it’s not supported, I’ll have to add a way to specify it if it’s not already being set in a SeleniumBase argument.
    Sy
    @symonk
    Cool the use case is our own internal zalenium grid
    Chrome on docker has problems with /dev/shm
    Michael Mintz
    @mintzworld_twitter
    @symonk You’re probably using an older version of SeleniumBase. The Docker shm update was done here: https://github.com/seleniumbase/SeleniumBase/commit/f0b5fead0d6a85f390052ba22bb8322ef50871fc#diff-f0033f44ac8ffcd3eb346e707c952b5e
    I’ve since updated that even more, and w3c is always set to True now.
    Sy
    @symonk
    we are currently using 1.31.6

    I also see a lot of this now:

    DEBUG    seleniumbase.virtual_display.easyprocess:easyprocess.py:109 param: "['Xvfb', '-help']" 
    DEBUG    seleniumbase.virtual_display.easyprocess:easyprocess.py:110 command: ['Xvfb', '-help']
    DEBUG    seleniumbase.virtual_display.easyprocess:easyprocess.py:111 joined command: Xvfb -help
    DEBUG    seleniumbase.virtual_display.easyprocess:easyprocess.py:228 OSError exception: [Errno 2] No such file or directory: 'Xvfb': 'Xvfb'

    not sure if its an actual issue

    will bump to 1.32.12
    Michael Mintz
    @mdmintz
    @symonk I bumped the requirements up again for 1.32.13, so let me know if you still see DEBUG messages and if that actually impacts your tests.
    Michael Mintz
    @mdmintz
    And if that didn't do the trick, I found a StackOverflow article that may have an answer for you: https://stackoverflow.com/a/32173967
    Sy
    @symonk
    I would like to build in more support to help with 'zalenium', i will scope out a PR or two and hopefully you like it
    Michael Mintz
    @mintzworld_twitter
    Sounds good.
    Sy
    @symonk
    theres a bug also i cant get to the bottom of it, but the latest_logs/module_class_method isnt created sometimes in CI, will have a poke around today :)
    peekyIL
    @pattarika
    @mintzworld_twitter how do I get row counts from a table? I have table 'table.ms-listviewtable' but stuck to loop and count # of rows
    i'm looking at base_case.py and looking for anything that I can use to lookup tag_name, but i don't see it
    peekyIL
    @pattarika
    this one seems to work table_rows = self.find_elements(table)
    print('Total rows: ' + str(len(table_rows)))
    for index, row in enumerate(table_rows):
    if row.text == self.pagename():
    print(f'{index}: {row.text}')
    break
    Michael Mintz
    @mintzworld_twitter
    @symonk Let me know what you find.
    @pattarika Sounds like you answered your own question.
    Michael Mintz
    @mdmintz
    Here's an example of correct pytest.mark.parameterize usage with SeleniumBase:
    https://github.com/seleniumbase/SeleniumBase/blob/master/examples/test_pytest_parameterize.py CC @symonk