1.tell me about your daily routine?
1) waking at 8:30 and refreshing and looking at changes in my website which is hosted at
myquora.myslns.com
and currently i am working at creating video for Java and then TestNG and Selenium.
2.why we are called overriding is runtime polymorphism?
If there are overridden methods, which method is to be executed depends on the type of object ; that
is decided at RUNTIME by the JVM. So this is "runtime polymorphism".
If a method is overloaded, the compiler decides which method is to be executed by verifying the
argument list and return type at compile time.
3.if string it is mutable what happened?
These are some more reasons for making String immutable in Java. These are:
The String pool cannot be possible if String is not immutable in Java. A lot of heap space is saved by
JRE.
The same string variable can be referred to by more than one string variable in the pool.
String interning can also not be possible if the String would not be immutable.
If we don’t make the String immutable, it will pose a serious security threat to the application.
For example, database usernames, and passwords are passed as strings to receive database
connections.
The socket programming host and port descriptions are also passed as strings.
The String is immutable, so its value cannot be changed.
If the String doesn’t remain immutable, any hacker can cause a security issue in the application by
changing the reference value.
The String is safe for multithreading because of its immutableness.
Different threads can access a single “String instance”.
It removes the synchronization for thread safety because we make strings thread-safe implicitly.
Immutability gives the security of loading the correct class by Classloader. For example, suppose we
have an instance where we try to load java.sql.Connection class but the changes in the referenced
value to the myhacked.The connection class does unwanted things to our database.
4.explain your framework
The Selenium Framework is a collection of tools that can be used to automate web application
testing.
It's a popular, open-source framework that's compatible with major browsers and operating systems
5.synchronization in selenium
In Selenium test automation, synchronization issues arise due to timing mismatches between test
script execution and webpage loading.
6.how to handle frames?
7.how to handle alerts?
8.How to handle tabs?
//span[contains(text(),'& Orders')]
//Get all the handles currently available
Set<String> handles=driver.getWindowHandles();
for(String actual: handles) {
if(!actual.equalsIgnoreCase(currentHandle)) {
//Switch to the opened tab
driver.switchTo().window(actual);
//opening the URL saved.
driver.get(urlToClick);
}
}
}
}
}
browser.getAllWindowHandles().then(function (handles)
{ browser.driver.switchTo().window(handles[1]);
browser.driver.close();
browser.driver.switchTo().window(handles[0]);
}
9.What is Takesscreenshot ? How it is working?
File screenshot = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
//Copy the file to a location and use try catch block to handle exception
try {
FileUtils.copyFile(screenshot, new File("C:\\projectScreenshots\\homePageScreenshot.png"));
} catch (IOException e) {
System.out.println(e.getMessage());
}
10.How to create Jenkins pipeline?
New Item-> Pipe Line
Wrie the script in Pipeline
Build Now and Console output
11.selenium vs playwright which one is better why?
Playwright
A good choice for modern web applications, Playwright is faster, more stable, and has advanced
features:
Speed: Playwright is optimized for speed and has built-in support for modern browsers
Setup: Playwright is easier to set up than Selenium, with built-in browser support
Features: Playwright has a modern API that simplifies complex UI interactions, and built-in support for
API testing, parallelization, reporting, debugging, and screenshot capabilities
Selenium
A good choice for projects that require compatibility with a wide range of browsers, including legacy
ones:
Browser support: Selenium has broad browser support and an established community
Language support: Selenium supports a broader range of languages than Playwright, including Ruby
and Kotlin
Ecosystem: Selenium has a mature ecosystem with deep integrations and plugins
12.why Javascript executer is used?
JavascriptExecutor in Selenium to click a button
[java]
js.executeScript(“document.getElementByID(‘element id ’).click();”);
[/java]
JavascriptExecutor in Selenium to send text
[java]
js.executeScript(“document.getElementByID(‘element id ’).value = ‘xyz’;”);
[/java]
JavascriptExecutor in Selenium to interact with checkbox
[java]
js.executeScript(“document.getElementByID(‘element id ’).checked=false;”);
[/java]
JavascriptExecutor in Selenium to refresh the browser window
[java]
js.executeScript(“location.reload()”);
[/java]
13.API : how we can send request body ?
public void UserRegistrationSuccessful()
{
RestAssured.baseURI ="https://demoqa.com/Account/v1";
RequestSpecification request = RestAssured.given();
JSONObject requestParams = new JSONObject();
requestParams.put("userName", "test_rest");
requestParams.put("password", "Testrest@123");
request.body(requestParams.toJSONString());
Response response = request.put("/User");
ResponseBody body = response.getBody();
System.out.println(response.getStatusLine());
System.out.println(body.asString());
14.Tell me about your restAssured framework ?
15.what is complete url? query and path parameters?
16.do you have database testing exeperience?
Database testing is a type of software testing, which is used to check the estimate of data integrity
and consistency under test and also examine the schema, table, data, etc of a database
A database schema is a logical and visual representation of a database's structure, organization, and
relationships.
It's a blueprint that shows how data is stored and organized in a database, and how different
elements of the database relate to each other.
17.String name="javawelcome" write java program for count the occurences of each character?
18.what language used for playwright project? javascript or java?
Java
19.what are the advanteges of playwright?
Playwright has many advantages, including:
Cross-browser support
Playwright supports multiple browsers, such as Chromium, WebKit, and Firefox, making it easier to
test application compatibility across different environments.
API testing
Playwright's built-in ability to intercept and modify network requests and responses makes it easy to
test and validate API interactions.
Auto-wait
Playwright automatically waits for elements to be ready before performing actions, which reduces
flakiness and eliminates the need for manual waits.
Reliable automation
Playwright offers powerful and reliable browser automation.
Headless execution
Playwright supports headless browser execution, which allows you to perform web scraping tasks
without using a visible browser window.
Trusted events
Playwright generates events that are indistinguishable from those created by real users, making them
"trusted" by browsers.
Built-in tools
Playwright has built-in tools such as Playwright Inspector for debugging, Test Generator for recording
and generating tests, and Trace Viewer for exploring tests' traces.
Documentation
Playwright's documentation uses practical examples to help users take advantage of the tool's
capabilities.
Playwright is a Microsoft tool that supports programming languages like Java, Python, and .NET. It can
be used on Windows, Linux, macOS, or CI.
20.what are the exceptions you faced in selenium?
NoSuchElementException
ElementNotVisibleException
NoSuchFrameException
NoAlertPresentException
NoSuchWindowException
SessionNotFoundException
StaleElementReferenceException
InvalidSelectorException
ElementNotSelectableException
TimeOutException
21.What is StaleReferenceException
The two most common reasons for a StaleElementReferenceException are that the selected HTML
element you have to interact with is no longer on the page, or it was destroyed and then recreated.
.
The only way to avoid a StaleElementReferenceException in a Selenium test is to refresh your stale
reference.
In other words, you have to re-apply the locator strategy and retrieve the HTML element again.