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 example of how to «hard-wait» (sleep) before any waiting command in Selene #447

Open
yashaka opened this issue Sep 27, 2022 · 5 comments

Comments

@yashaka
Copy link
Owner

yashaka commented Sep 27, 2022

... to slow it down and be more like real user;)

Provide example for pre_pause_in_wait decorator for confi._wait_decorator similar to the existing example: https://github.com/yashaka/selene/blob/master/examples/log_all_selene_commands_with_wait.py

There are some extra explanations with amost done receipt in this telegram message (in russian, but the translation should be obvious, Google Translate bless you!🙏🏻)

@deepgohil
Copy link

@yashaka I would like to take this up. As this will be my first contribution to this repo. if you can guide me it will be very helpful.

@yashaka
Copy link
Owner Author

yashaka commented Dec 6, 2022

@deepgohil
I would like to help you with this, but taking into account lack of time - faster would be to do it on my own.
I still can help, but not in the way "giving direct guided tasks what to do". The original message already has some hints where to start. If you have a few questions to clarify something - with this I can help. But to guide fully through corresponding implementation - for this I don't have time.

Maybe somebody other will help you, some other more experienced contributor.

Or just wait for the task that already has more complete guide...

@yashaka
Copy link
Owner Author

yashaka commented Dec 6, 2022

related to
#456 #459

@vaibhavsahni009
Copy link

@yashaka correct me if I am wrong, but we would need to create an example similar to the one you have mentioned but instead of logging decorator would be pausing/waiting to mimic human behavior. if yes please assign this issue to me.
Thanks

@yashaka
Copy link
Owner Author

yashaka commented Apr 3, 2023

@vaibhavsahni009, yes, just similar to example I show, but with some sleep instead of logging.

If in the original example we had:

@pytest.fixture(scope='function', autouse=True)
def browser_management():
    SeleneFormatter.translations = (
        ('browser.element', 'element'),
        ('browser.all', 'all'),
        ("'css selector', ", ""),
        (r"('\ue007',)", "Enter"),
        ('((', '('),
        ('))', ')'),
        (': has ', ': have '),
        (': have ', ': should have '),
        (': is ', ': should be'),
    )
    browser.config._wait_decorator = log_on_wait

    yield

in the new example we should have something like:

@pytest.fixture(scope='function', autouse=True)
def browser_management():
    browser.config._wait_decorator = sleep_before_wait_starts(seconds=1.0)

    yield
    

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants