#AskRaghav
Вставка
- Опубліковано 1 чер 2024
- All Free Tutorials 🟢 AutomationStepByStep.com/
00:00 Intro
00:30 Scenario 1:
You are asked to automate a test case that requires you to scroll to the bottom of a page. How would you do this?
Answer:
There are a few ways to do this:
Scroll to element
Scroll by given amount
Scroll from an element by a given amount
Scroll from an element with an offset
Scroll from a offset of origin (element) by given amount
www.selenium.dev/documentatio...
_______________________________________________
03:09 Scenario 2:
You are asked to automate a test case that requires you to click on a button that is only visible after a certain condition is met. How would you do this?
Answer:
One way to do this is to use an explicit wait. An explicit wait is a wait that is used to wait for a specific condition to be met before continuing with the execution of the script. In this case, you would use an explicit wait to wait for the button to become visible before clicking on it
driver.get("example.com");
WebDriverWait wait = new WebDriverWait(driver, 10);d
// Define the expected condition (element to be clickable)
By buttonLocator = By.id("your-button-id"); /
WebElement button = wait.until(ExpectedConditions.elementToBeClickable(buttonLocator));
// Click the button
button.click();
driver.quit();
_______________________________________________
04:30 Scenario 3:
You are asked to automate a test case that requires you to interact with a JavaScript alert. How would you do this?
Answer:
There are a few ways to do this. One way is to use the switchTo() method. Once you have switched the focus to the JavaScript alert, you can then use the accept() method to accept the alert or the dismiss() method to dismiss the alert. We can also use the Selenium Alert interface
www.selenium.dev/documentatio...
_______________________________________________
06:23 Scenario 4:
You are testing a web application that uses iframes for displaying content from different sources. How would you automate interactions within these iframes?
Answer:
To automate interactions within iframes in Selenium, I would follow these steps:
Identify the iframes by using their locators (e.g., id or name attributes).
Switch to the desired iframe using driver.switchTo().frame(frameLocator) method.
Perform actions and assertions within the iframe.
After completing actions within the iframe, switch back to the default content using driver.switchTo().defaultContent() to continue testing on the main page.
www.selenium.dev/documentatio...
09:20 Outro
▬▬▬▬▬▬▬
Every Like & Subscription gives me great motivation to keep working for you
You can support my mission for education by sharing this knowledge and helping as many people as you can
If my work has helped you, consider helping any animal near you, in any way you can
Never Stop Learning
Raghav Pal
-
Thanks Raghav .
These are very useful in interviews thanks a lot
Most welcome Satya
Thanks. Very useful.
You're welcome!
Thank you sir.. helpful
Most welcome
Soo good, cut to the chase
Thanks Prajwal
Thanks ❤
You're welcome Shekhar
hello sir , i recently gave an interview where interviewer asked me question on how long does it take a test case to stabilize ? although i was not able to answer this .
please can u help me with the answer
Gaurav
The time it takes for a test case to stabilize can vary depending on a number of factors, including the complexity of the test case, the frequency of code changes, and the stability of the application under test. In general, it can take anywhere from a few days to a few months to stabilize a test case.
Here are some factors that can affect the time it takes for a test case to stabilize:
* **Complexity of the test case:** The more complex a test case is, the more likely it is to be affected by code changes. For example, a test case that involves multiple pages or interactions is more likely to break than a test case that involves a single page or interaction.
* **Frequency of code changes:** The more frequently code changes are made, the more likely it is that test cases will break. This is because code changes can introduce new bugs or fix existing bugs in ways that affect the behavior of test cases.
* **Stability of the application under test:** If the application under test is unstable, then test cases are more likely to break. This is because unstable applications can exhibit unexpected behavior that can cause test cases to fail.
There are a number of things that can be done to help stabilize test cases:
* **Write test cases that are well-defined and easy to understand.** This will make it easier to identify and fix problems when they occur.
* **Use a test automation framework that supports test case modularity and reusability.** This will make it easier to isolate and fix problems when they occur.
* **Use a test case management tool to track the status of test cases and to identify trends in test case stability.** This will help to identify areas where test cases are more likely to break.
* **Monitor the performance of test cases on a regular basis.** This will help to identify problems early on before they cause major disruptions.
By following these tips, you can help to stabilize test cases and reduce the amount of time it takes to fix problems when they occur.
@@RaghavPalThank you so much !! I'm sure this will definitely going to help many of us 💯