Answer :- Classes and Interfaces :- First letter of class/ interface should be capital Variable and Packages :- All letter should be in small case Methods :- mixed case with the first letter lowercase and with the first letter of each internal word capitalised Constants :- Should be all uppercase with words separated by underscores (“_”)
Site to refer :- https://www.geeksforgeeks.org/java-naming-conventions/
Question:- Difference between hard assert and soft assert in Selenium?
Answer:- SOFT ASSERT:- It aggregates the errors occurred during the test execution. If such an assert fails the controls jumps to the next page.
HARD ASSERT:- It immediately responds with an AssertException and breaks the current test. After that, the next case in the sequence gets executed.
Question:- Difference between assert and verify?
Answer:- Assert: It allows us to verify the result of an expression or an operation. If the “assert” fails, then it will abort the test execution and continues with the next case.
Verify: It also operates the same as the assert does. However, if the “verify” fails, then it won’t abort the test instead continues with the next step.
Question:- What are the different waits available in web driver?
Answer:- In selenium web driver, following three types of wait mechanisms are available:-
Implicit Wait:It is a wait timeout which applies to a Webdriver instance. It implies that all actions of this instance will timeout only after waiting for a duration specified by the implicit wait.
WebDriver driver = new ChromeDriver(); driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);
Explicit Wait: :- It is an exclusive timeout method that works by adding code to delay the execution until a specific condition arises. It is more customizable in terms that we can set it up to wait for any suitable situation. Usually, we use a few of the pre-built Expected Conditions to wait for elements to become clickable, visible, invisible, etc.
WebDriver driver = new ChromeDriver(); driver.get("http://target_page_url"); WebElement dynamicElement = (new WebDriverWait(driver, 15)) .until(ExpectedConditions.presenceOfElementLocated(By.id("dynamicElement")));
Fluent Wait:Fluent wait is another type of Explicit wait and you can define polling and ignore the exception to continue with script execution in case element is not found. new FluentWait(driver). withTimeout(30, TimeUnit. SECONDS). pollingevery (10, TimeUnit.SEconds).
Question: What is the command to click on a hyperlink in selenium web driver?
Question :- Which naming convention you used
Answer :- i used camel casing
Question :-Can you explain what camel casing is ?
Answer :-
Classes and Interfaces :- First letter of class/ interface should be capital
Variable and Packages :- All letter should be in small case
Methods :- mixed case with the first letter lowercase and with the first letter of each internal word capitalised
Constants :- Should be all uppercase with words separated by underscores (“_”)
Site to refer :- https://www.geeksforgeeks.org/java-naming-conventions/
Question:- Difference between hard assert and soft assert in Selenium?
Answer:- SOFT ASSERT:- It aggregates the errors occurred during the test execution. If such an assert fails the controls jumps to the next page.
HARD ASSERT:- It immediately responds with an AssertException and breaks the current test. After that, the next case in the sequence gets
executed.
Question:- Difference between assert and verify?
Answer:- Assert: It allows us to verify the result of an expression or an operation. If the “assert” fails, then it will abort the test execution
and continues with the next case.
Verify: It also operates the same as the assert does. However, if the “verify” fails, then it won’t abort the test instead continues with
the next step.
Question:- What are the different waits available in web driver?
Answer:- In selenium web driver, following three types of wait mechanisms are available:-
1.) Implicit Wait
2.) Explicit Wait
3.) Fluent Wait
Implicit Wait:It is a wait timeout which applies to a Webdriver instance. It implies that all actions of this instance will timeout only after
waiting for a duration specified by the implicit wait.
WebDriver driver = new ChromeDriver();
driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);
Explicit Wait: :- It is an exclusive timeout method that works by adding code to delay the execution until a specific condition arises.
It is more customizable in terms that we can set it up to wait for any suitable situation. Usually, we use a few of the
pre-built Expected Conditions to wait for elements to become clickable, visible, invisible, etc.
WebDriver driver = new ChromeDriver();
driver.get("http://target_page_url");
WebElement dynamicElement = (new WebDriverWait(driver, 15))
.until(ExpectedConditions.presenceOfElementLocated(By.id("dynamicElement")));
Fluent Wait:Fluent wait is another type of Explicit wait and you can define polling and ignore the exception to continue with script
execution in case element is not found. new FluentWait(driver). withTimeout(30, TimeUnit. SECONDS). pollingevery
(10, TimeUnit.SEconds).
Question: What is the command to click on a hyperlink in selenium web driver?
Answer:- webdriver.findelement(By.linkText("welcome")).click();
Question: What is the difference between Web Driver's close() and quit() methods?
Answer:- webdriver.close(): It closes the active WebDriver instance.
webdriver.quit(): It closes all the WebDriver instances opened at a time.
Question: Do you lnow the parent interface of web driver?
Answer: Search Context