Selenium Python Tutorial #43 - Explicit Wait in Selenium Python

  Рет қаралды 22,150

Software Testing Mentor

Software Testing Mentor

Күн бұрын

Пікірлер: 23
@NicolasChanCSY
@NicolasChanCSY 2 жыл бұрын
Hi Sir, in case of a website with quite a lot of AJAX/async JS, are there any reliable strategy to wait until the JS is complete and I can safely continue the automation? Currently I use quite a lot of `driver.execute_script("return document.readyState") == "complete"` trying to mitigate the issue but this is not very reliable. And as you mentioned in the video, using `time.sleep(...)` is not reliable and may compromise performance unnecessarily.
@tranfb552
@tranfb552 2 жыл бұрын
thank you very much for your videos
@mrseregasss435
@mrseregasss435 Жыл бұрын
Hello Why in time 9:12 locator have (( )) ? [locator=By.Xpath, ...]
@BurnedZero
@BurnedZero 2 жыл бұрын
very good and well explained, my friend!! Gonna start a qa tester course soon and I'm already studying automation as much as I can.
@AznBMan75
@AznBMan75 2 жыл бұрын
Hi sir! How would I do a wait after I manually login, and pass through a few security pages then to the page that I want automate. The program will get to the front page, and then wait for me to login through 4 security pages. And, then it finally lands on the page that I want to automate, and then it will click on "href" or title of the element of the page to open a new tab page.
@NicolasChanCSY
@NicolasChanCSY 2 жыл бұрын
I see 3 ways of doing this: 1. You manually add an `input("Press Enter/Return to continue.")` statement to your code where you want the program to wait. Upon reaching the `input` statement, the program would pause and wait for your console input. You can then do whatever you need to until you reach the continue-automation page, and then you return an empty string to the console input to continue the automation. This is easiest to do, but most "low-tech". 2. You add a Explicit/Fluent Wait to wait until the URL of the page or title of the page matches your continue-automation page. Note that your `timeout` argument value may need to be set larger than usual, because humans are much slower than machines, especially for security pages. This is harder to do, but is more responsive, and requires less human intervention. You may need to define your own expected condition for WebDriverWait to check. The expected condition should be a callable taking in one and only one argument for the webdriver, and should return a truthy/falsy value (Definition of Python truthy/falsy values: stackoverflow.com/questions/39983695/what-is-truthy-and-falsy-how-is-it-different-from-true-and-false). e.g. WebDriverWait(driver, 300).until(lambda d: ...) 3. Try automate the security pages. In case of login credentials or secret tokens, try to use a .env file (python-dotenv maybe helpful). Needless to say, this is the hardest, but most likely fastest.
@codyhabrock4751
@codyhabrock4751 3 жыл бұрын
Very awesome thanks! Explained very well!
@Undrios
@Undrios 5 ай бұрын
Thank you sir
@DataWiseDiscoveries
@DataWiseDiscoveries 2 жыл бұрын
Is there any video missing sir, or it is complete playlist?
@HarisZafar-zz5ou
@HarisZafar-zz5ou 4 ай бұрын
I am facing an issue with implementing this. Can any one help?
@АлександрК-ш
@АлександрК-ш 2 жыл бұрын
Hello. Can you please tell me where to find the source code?
@poreshrautofficial7076
@poreshrautofficial7076 2 жыл бұрын
Thank you sirr
@ibragimvisitaev6981
@ibragimvisitaev6981 Жыл бұрын
thanks bud
@pearlmm5869
@pearlmm5869 2 жыл бұрын
TypeError: element_to_be_clickable() takes 1 positional argument but 2 were given shown in my picharm
@SanjeevKumar-zm2li
@SanjeevKumar-zm2li 10 ай бұрын
You are missing paranthesis
@umeshmore317
@umeshmore317 3 жыл бұрын
Hello Sir, Is there any link from where we can download the code?
@softwaretestingmentor
@softwaretestingmentor 3 жыл бұрын
Hi Umesh, I will be uploading full code once the whole series is complete. Thanks, Manish
@amitwaltzer
@amitwaltzer 3 жыл бұрын
Hello Sir, i didn't quite understand how u can chain the "find_elements" after the "wait.until", can you explain what does wait.until return (was sure it was an element)
@NicolasChanCSY
@NicolasChanCSY 2 жыл бұрын
According to the API reference [1], `.until(...)` would return the returned value from the last method call in it. And many expected conditions in Selenium library returns the webelement if the target element is found and passes the checking condition, otherwise returns False [2]. For example, `element_to_be_clickable`, `visibility_of`, `presence_of_all_elements_located`, to name but a few. Hence, he can chain the method calls in the video. [1] www.selenium.dev/selenium/docs/api/py/webdriver_support/selenium.webdriver.support.wait.html#selenium.webdriver.support.wait.WebDriverWait.until [2] www.selenium.dev/selenium/docs/api/py/webdriver_support/selenium.webdriver.support.expected_conditions.html
@KaranRaj-bm4xl
@KaranRaj-bm4xl 2 жыл бұрын
what if it takes more than 10 secs sir?
@thoufeequeabdulrahmanrafiq4438
@thoufeequeabdulrahmanrafiq4438 2 жыл бұрын
it will fail. increase the wait time in that case.
@bahriaproperties1143
@bahriaproperties1143 2 жыл бұрын
wait could had been said in 5 mins took16 mins
PyTest Tutorial #1 - What is PyTest | How to Install PyTest
10:17
Software Testing Mentor
Рет қаралды 86 М.
Selenium Python Tutorial #42 - Implicit Wait in Selenium Python
7:52
Software Testing Mentor
Рет қаралды 9 М.
Lamborghini vs Smoke 😱
00:38
Topper Guild
Рет қаралды 48 МЛН
Quilt Challenge, No Skills, Just Luck#Funnyfamily #Partygames #Funny
00:32
Family Games Media
Рет қаралды 38 МЛН
Farmer narrowly escapes tiger attack
00:20
CTV News
Рет қаралды 13 МЛН
Selenium Python Tutorial #35 - How to handle Frames in Selenium Python
12:47
Software Testing Mentor
Рет қаралды 16 М.
Python Selenium - Wait Times Explained for Beginners (English)
8:47
WsCube Tech! ENGLISH
Рет қаралды 2,9 М.
Selenium Python Tutorial #44 - Fluent Wait in Selenium Python
6:24
Software Testing Mentor
Рет қаралды 9 М.
Selenium Python Tutorial #36 - How to handle Alerts in Selenium Python
13:44
Software Testing Mentor
Рет қаралды 13 М.
Explicit - WebDriverWait in Selenium Python - 12
39:23
Naveen AutomationLabs
Рет қаралды 11 М.
Fluent Wait in Selenium Python (Selenium Python)
9:46
QAFox
Рет қаралды 1,2 М.
Selenium Python Tutorial #30 - How to handle Auto Suggestion in Selenium
20:31
Software Testing Mentor
Рет қаралды 15 М.
Lamborghini vs Smoke 😱
00:38
Topper Guild
Рет қаралды 48 МЛН