Synchronization:
----------------------------
The communication between Selenium Webdriver script and the Application under Test
(AUT) is known as synchronization. Rendering of the Page takes time due to network bandwidth:Display images, content, html components.
Most of the Intermittent Issues are due to the race conditions between the browser and webdriver commands.
Resolution:
--------------------
Insert wait statements in the script. they are two types of wait.
1. Unconditional Wait:
-------------------------
Thread.sleep(long timeinmilliseconds); ex: Thread.sleep(25000);
In java Thread is class and sleep is a static method.
Also it is applicable only for one line of statement.
We need to add this before the statemet which needs to be find out.
Thread.sleep(5000); // 5 seconds...
driver.findElement(By.id("username")).sendKeys("selenium");
2. Conditional Wait:
---------------------
a. Implicit Wait
b. Explicit Wait
Implicit Wait
---------------------
WebDriver polls the DOM (Document Object Model) for certain duration of time when trying to find any element.
This can be useful when certain elements on the webpage are not available immediately and need some time to load.
driver.manage().timeouts().implicitlyWait(30,TimeUnit.SECONDS);
This statment is applicable for all the findElement and findElements() methods in the program.
driver.findElement(By.id("username")).sendKeys("selenium");
Scenario -
1. Available immediately proceed to next line
2. Not available immediately and available after 5 few seconds gotonext line.
3. Not Available with in 30 seconds wait for 30 secs and throw exception
Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 85.0.4183.121, chrome: {chromedriverVersion: 85.0.4183.87 (cd6713ebf92fa..., userDataDir: C:\Users\qa\AppData\Local\T...}, goog:chromeOptions: {debuggerAddress: localhost:51226}, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: WINDOWS, platformName: WINDOWS, proxy: Proxy(), setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:virtualAuthenticators: true}
Session ID: da359b0a7e711e6d2f85569fd3637309
*** Element info: {Using=id, value=firstName1234}
Check out my blog as well http://total-qa.com
PlayList Details:
SOAPUI:
• SOAPUI
SELENIUM INTERVIEW QUESTIONS:
• Selenium Interview Questions
PAGE OBJECT MODEL PRINCIPLES:
• PageObjectModel
JENKINS:
• JENKINS
REST API TUTORIAL:
• REST API TUTORIAL
JAVA:
• Java
SELENIUM WEBDRIVER:
• Selenium WebDriver
XPATHTUTORIAL:
• Xpath Tutorial
CssSelector:
• Css Tutorial
GITHUB:
• GITHUB