Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Sy
    @symonk
    honestly, very hard to figure it out but il keep an eye on it
    and yes, i attach screenshot, page source and basic info on failures, occassionally there is no folder for the test in latest_logs
    it could be due to an exception happening somewhere outside the test scope etc, il have to investigate
    Michael Mintz
    @mdmintz
    Big day: 25 new GitHub stars for SeleniumBase
    peekyIL
    @pattarika
    My code needs to provide a lot of parameters and I don't want to put everything in --data how can I add additional argparse ?
    Michael Mintz
    @mintzworld_twitter
    @pattarika Put parameters in a file. Then parse the file. Here’s an example: https://github.com/seleniumbase/SeleniumBase/blob/master/examples/boilerplates/file_parsing/parse_files.py
    peekyIL
    @pattarika
    Thank you, let me check it out
    jazz198833
    @jazz198833
    @mdmintz hi, i will appreciate if you help me. I have next problem when i'm trying to extend list of methods in base_case. For example when i added new method:
    def push_tab(self):
    from selenium.webdriver.common.action_chains import ActionChains
    ActionChains(self.driver).send_keys(Keys.TAB).perform()
    And when i'am using it in my test i've got next problem

    def test_search(self):
    self.open('https://demo.opencart.com/')

      self.press_tab()

    E AttributeError: 'Test' object has no attribute 'press_tab'

    basic_test.py:13: AttributeError

    Peter Nguyen Tr
    @PeterNgTr
    you define def push_tab(self): but you call self.press_tab()?
    jazz198833
    @jazz198833
    class Test(BaseCase):
    def test_search(self):
        self.open('https://demo.opencart.com/')
        self.press_tab()
    Michael Mintz
    @mdmintz
    @jazz198833 As @PeterNgTr already said, you defined push_tab(), but then you called press_tab() instead. Check your method spelling.
    jazz198833
    @jazz198833
    @mdmintz sorry, i made a typo. I'm using correct method the same what i created. but unfortunately get an error. In the base_case.py
    def get(self, url):
        """ Same as open() - WebDriver uses this method name. """
        self.open(url)
    
    def push_tab(self):
        from selenium.webdriver.common.action_chains import ActionChains
        ActionChains(self.driver).send_keys(Keys.TAB).perform()
    in my test
    i don't see this method in test class. He is not defined when i starting write name of function

    from seleniumbase import BaseCase

    class Test(BaseCase):

    def test_search(self):
        self.open('https://www.google.com.ua/')
        self.push
    what i'm doing wrong. Can you help how to extend my own methods
    Michael Mintz
    @mintzworld_twitter
    @jazz198833 You just defined “push_tab()” and you tried referencing it with just “push”. Please check your spelling and don’t forget parentheses for method calls.
    jazz198833
    @jazz198833

    from seleniumbase import BaseCase

    class Test(BaseCase):

    def test_search(self):
        self.open('https://www.google.com.ua/')
        self.push_tab()
    the same error
    Peter Nguyen Tr
    @PeterNgTr
    hi, you update the base_case.py of seleniumbase or you extend from it?
    jazz198833
    @jazz198833
    hi. I want to update it by adding that method. But i dont understand how to make it work.
    Peter Nguyen Tr
    @PeterNgTr

    all right, maybe you can follow this path:

    • create your base that extends from seleniumbase: for instance, you name it base.py
    from selenium.webdriver.common.action_chains import ActionChains
    from seleniumbase import BaseCase
    
    class BaseTestCase(BaseCase):
         def push_tab(self):
               ActionChains(self.driver).send_keys(Keys.TAB).perform()

    Now in your test file

    from base import BaseTestCase
    
    class MyFeature(BaseTestCase):
    
        @pytest.mark.testrail('C1234')
        def test_search(self):
             self.open('https://www.google.com.ua/')
             self.push_tab()
    Peter Nguyen Tr
    @PeterNgTr
    Please format it. Kinda hard to read
    jazz198833
    @jazz198833
    Here i created new module base_new.py

    from selenium.webdriver.common.action_chains import ActionChains
    from selenium.webdriver.common.keys import Keys
    from seleniumbase import BaseCase

    class BaseTestCase(BaseCase):
    def push_tab(self):
    ActionChains(self.driver).send_keys(Keys.TAB).perform()
    self.push_tab()

    afterwards created test file basic_test.py

    from seleniumbase import BaseCase
    from seleniumbase.fixtures.base_new import BaseTestCase

    class Test(BaseCase,BaseTestCase):
    def test_search(self):
    self.open('https://www.google.com.ua/')
    self.push_tab()

    And when i'm running my test i'm getting import error
    ImportError while importing test module '/Users/niko/Downloads/SeleniumBase-master/examples/basic_test.py'.
    Hint: make sure your test modules/packages have valid Python names.
    Traceback:
    basic_test.py:2: in <module>
    from seleniumbase.fixtures.base_new import BaseTestCase
    E ModuleNotFoundError: No module named 'seleniumbase.fixtures.base_new'
    peekyIL
    @pattarika
    Anyone has sample to use seleniumbase with jenkins? I am building jenkinfiles and struggle with passing username and password.
    stage('Test') {
    withCredentials([[$class: 'UsernamePasswordMultiBinding',
    credentialsId: 'accessTokenToAzureRepo',
    usernameVariable: 'USERNAME',
    passwordVariable: 'PASSWORD']]) {
    dir("${env.WORKSPACE}/SharePoint"){
    script{
    sh ("""docker exec -t sp pytest \
    --browser=remote --server selenium-hub --port 4444 \
    --cap_file=capabilities/firefox.py --headless \
    --log_path=tests/latest_logs --save_screenshot \
    --data=X_SITE_1,education,${USERNAME},${PASSWORD} \
    --verbose -k verify""")
    }
    }
    }
    sorry i don't know how to format the syntax
    Michael Mintz
    @mdmintz
    Sy
    @symonk
    @mdmintz I think when trying to click an element that isnt there etc, latest_logs writing to the file system doesnt work
    I get no latest_log files written to when my tests fails with: selenium.common.exceptions.ElementNotVisibleException
    --save_screenshot does indeed work
    Sy
    @symonk
    has_exception looks to be False in this instance
    (pytest)
    Michael Mintz
    @mdmintz
    @symonk Try upgrading to the latest version of SeleniumBase and try again. It was working for me just now.
    Sy
    @symonk
    are you using pytest? i think its related to that @mdmintz
    has_exception in base case is False, even tho this exception occured
    Sy
    @symonk
    (Pdb) has_exception False (Pdb) self.save_screenshot_after_test False (Pdb) has_exception False (Pdb) self.with_testing_base True
    no files in latest_logs
    Michael Mintz
    @mintzworld_twitter
    I could not reproduce on my build. I’m using pytest. I have the SeleniumBase pytest.ini file at the base of my repo. Not sure if you made any modifications that would alter that functionality.
    Sy
    @symonk
    quite likely, will just check - we have made some recently :) (cut the inheritance)