Selenium/TestNG/Azure/Jenkins

Ace your homework & exams now with Quizwiz!

What does git clone do?

The command creates a copy (or clone) of an existing git repository. Generally, it is used to get a copy of the remote repository to the local repository.

what are the core components of a good test automation framework?

1. Base class that specifies behavior of the web driver such as startDriver or quit driver based on the specifics that we need for example which browser to use 2. Page object classes 3. pojo classe 4. util classes, for example Jackson utils to handle json objects, property loaders, configurations loaders, handling cookies, etc. 5. reporting 6. data providers 7. logging if something goes wrong 8. screenshots if necessary Tests should run in parallel.

What are the core components of an HTTP request?

1. HTTP Request methods like:, PUT, POST, DELETE. 2. Base Uniform Resource Identifier (URI) 3. Resources and Parameters 4. Request Header, which carries metadata (as key-value pairs) for the HTTP Request message. 5. Request Body, which indicates the message content or resource representation.

What is a version control system (VCS)?

A VCS keeps track of the contributions of the developers working as a team on the projects. They maintain the history of code changes done and with project evolution, it gives an upper hand to the developers to introduce new code, fixes bugs, and run tests with confidence that their previously working copy could be restored at any moment in case things go wrong.

What all challenges are included under API testing?

API Documentation Access to DB Authorization overhead when it comes to managing tokens

Best Practices in using xpath

Avoid Absolute XPaths: They are brittle and likely to break with any UI changes. Use Relative XPaths: They are more resilient to changes in the UI structure. Inspect Elements Carefully: Tools like Chrome DevTools can help you understand the structure of the HTML and find patterns in dynamic attributes. Test and Validate: Ensure your XPath expressions work as expected by testing them in the browser's developer console or using tools designed for testing XPath queries.

Handling Authentication Pop-up, Alerts, Waits

Basic Authentication Pop-up: Pass credentials in the URL or use browser profiles. Alerts: Use WebDriver's Alert interface to interact with alerts. Waits: Utilize explicit waits (WebDriverWait) to wait for certain conditions or implicit waits to set a global waiting time.

Different Types of Authentication

Basic Authentication: Uses a username and password encoded in base64 format included in the request headers. Digest Authentication: Similar to basic authentication but with added security features like nonce values to prevent replay attacks. API Key: A unique identifier used to authenticate a user, developer, or calling program to an API. OAuth: An open standard for access delegation, used as a way to grant websites or applications access to their information on other websites but without giving them the passwords. JWT (JSON Web Tokens): A compact, URL-safe means of representing claims to be transferred between two parties. The claims in a JWT are encoded as a JSON object that is used as the payload of a JSON Web Signature (JWS) structure or as the plaintext of a JSON Web Encryption (JWE) structure. OAuth 2.0: The industry-standard protocol for authorization, focusing on client developer simplicity while providing specific authorization flows for web applications, desktop applications, mobile phones, and living room devices.

Why fluent waits are not popular?

Because there is usually no need to, it doesn't give any real advantages over explicit waits, we can think of fluent ways as of advanced explicit waits. In reality we can just use explicit waits without specifying the polling frequency.

How to handle dynamic xpath

Contains() Function Using OR & AND Operators Starts-with() Function

What is CSRF?

Cross-Site Request Forgery (CSRF) is a type of security vulnerability that allows an attacker to induce users to perform actions that they do not intend to perform on a web application in which they're currently authenticated. It exploits the trust that a web application has in the user's browser and can lead to unauthorized commands being transmitted by the user.

Challenges faced in Selenium Automation and how did you handle that error?

Dealing with Stale Element Exceptions Problem: The team frequently encountered stale element reference exceptions when trying to interact with elements that had been dynamically updated or replaced in the DOM after an AJAX call. This was particularly problematic in the checkout process, where elements like discount code input fields and payment method options were dynamically updated. Solution: To overcome this, the team adopted several strategies: Re-locating Elements: They modified their scripts to re-locate elements right before interacting with them, ensuring that they had fresh references to the elements. Try-Except Blocks: Implemented try-except blocks to catch stale element exceptions, with retries to locate the element again within the exception handling code. Strategic Waits: Introduced strategic waits before performing actions that were known to update the DOM, minimizing the chance of interacting with stale elements.

How would you handle getting data out of an HTML table?

Depends very much how was it implemented. If it has labels and the labels are linked with the data, use the label as key and get its rows. You can either use the order to get data from or a text, or attribute if you know what you want to put into a condition. Probs you can have a map with label as key and the rows list as value.

Desired Capabilities vs. Chrome Options:

Desired Capabilities: Desired Capabilities is a concept used in Selenium WebDriver to specify the characteristics or settings for a web browser or mobile device that you want to use for your automated tests. It is a set of key-value pairs that define various properties like browser name, version, platform, and other options. These capabilities are used to configure the WebDriver instance and establish a connection to the browser or device. Chrome Options: Chrome Options is a specific set of capabilities used when working specifically with the Google Chrome browser in Selenium. It allows you to customize and configure various Chrome-specific settings, such as adding command-line arguments, setting preferences, managing browser windows, and handling SSL certificates. Chrome Options is a subset of Desired Capabilities focused on Chrome-specific configurations.

Handling Radio Buttons and Dropdowns

First, locate and click the desired radio button using standard WebDriver locating techniques. After the dropdown appears, you can interact with it using the Select class or by directly clicking the dropdown values based on their locators.

What are commonly used HTTP Methods?

GET: It enables you to retrieve data from a server POST: It enables you to add data to an existing file or resource in a server PUT: It lets you replace an existing file or resource in a server DELETE: It lets you delete data from a server

how to write xpath for iframes, Ajax, SPAs?

Handling iframes: Switch to the iframe context Write XPath as usual Switch back to the main document Handling Ajax and SPAs: Ajax-loaded content and SPAs can change without the page itself being reloaded. This can make elements hard to find if they haven't been loaded yet, or if they change dynamically. Wait for elements to be loaded or become visible then use attributes and text content that are less likely to change, instead of relying on specific IDs or classes that might be dynamically generated. Use contains(), starts-with(), or ends-with() functions to match elements based on partial attribute values or text, which can be useful when dealing with elements that have dynamically generated IDs or classes.

Locators supported by selenium?

ID, name, CSS, Xpath, class, tag, linktext, partial link text

When to use explicit waits?

Ideally, on each web element that we need

What is Rest API?

REST stands for Representational State Transfer. It is a set of functions helping developers in performing requests and receive responses. Interaction is made through HTTP Protocol in REST API.

Factory design pattern in selenium test automation:

In Selenium, the Factory pattern, specifically a form of the Factory Method, is commonly used to create instances of WebDriver. The WebDriver is an interface, and the specific implementation (like ChromeDriver, FirefoxDriver, InternetExplorerDriver, etc.) is chosen at runtime based on the desired browser. Here's how it typically works: WebDriver Interface: The main interface that all drivers (ChromeDriver, FirefoxDriver, etc.) implement. It provides the methods that are used for browser manipulation and navigation. Concrete Drivers: Each browser has its own concrete implementation of the WebDriver interface (e.g., ChromeDriver for Google Chrome, FirefoxDriver for Mozilla Firefox). Factory Method: Although Selenium does not provide a built-in factory class in its API, the pattern is used when developers implement their own factory to create instances of WebDriver. This factory method decides which browser driver to instantiate based on some input (like browser type specified in configuration or system properties).

How to prioritize test cases in TestNG?

In TestNG "Priority" is used to schedule the test cases.at is we can execute Test case in order. In order to achive, we use need to add annotation as @Test(priority=??). The default value will be zero for priority.

Thread Count in TestNG

In TestNG, a test framework for Java, the thread count refers to the number of parallel threads or instances in which your test methods can run concurrently. TestNG allows you to specify the thread count at various levels, such as at the suite, test, or method level. Controlling thread count is useful for achieving parallelism in your test executions, which can significantly speed up test suite execution.

Подробно о Thread Safety в automation frameworks? Why Thread Safety is Important?

In an automation framework, especially when tests are executed in parallel: Isolation: Each test should run in isolation to ensure that the actions or data of one test do not affect another. Stability: Ensures the test suite is stable and reliable, with predictable outcomes for each test execution. Performance: Properly managed threads can significantly improve the performance of your test suite by utilizing system resources efficiently. Achieving Thread Safety with ThreadLocal ThreadLocal in Java provides thread-local variables. These variables differ from their normal counterparts in that each thread accessing such a variable via a get or set method has its own, independently initialized copy of the variable. ThreadLocal instances are typically private static fields in classes that wish to associate state with a thread. ThreadLocal can be used to ensure that each thread has its own instance of WebDriver. This way, when tests are run in parallel, each test thread can interact with its own browser session without affecting others. Best Practices for Thread Safety in Automation Frameworks Initialization and Cleanup: Ensure that each thread correctly initializes its test environment before tests run and cleans it up afterwards. ThreadLocal variables should be removed once a test is finished to prevent memory leaks. Accessing Shared Resources: Be cautious when accessing shared resources from tests. Use synchronization mechanisms if necessary to prevent race conditions. Logging and Reporting: Ensure that logging and reporting are configured to handle parallel execution correctly. Logs should be separated or clearly marked to indicate which test and thread they belong to. Avoid sharing test data between threads unless it is immutable or properly synchronized.

Tips on working with locators?

In general, if HTML IDs are available, unique, and consistently predictable, they are the preferred method for locating an element on a page. They tend to work very quickly, and forego much processing that comes with complicated DOM traversals. If unique IDs are unavailable, a well-written CSS selector is the preferred method of locating an element. XPath works as well as CSS selectors, but the syntax is complicated and frequently difficult to debug. Though XPath selectors are very flexible, they are typically not performance tested by browser vendors and tend to be quite slow. Selection strategies based on linkText and partialLinkText have drawbacks in that they only work on link elements. Tag name can be a dangerous way to locate elements. There are frequently multiple elements of the same tag present on the page. This is mostly useful when calling the findElements(By) method which returns a collection of elements. The recommendation is to keep your locators as compact and readable as possible. Asking WebDriver to traverse the DOM structure is an expensive operation, and the more you can narrow the scope of your search, the better.

There is a submit button in page it has id property. By using "id" we got "element not found expectation", how will you handle this situation? What might be the problem in this case?

In this situation, there are mainly two reasons that are:- ID is not matching ID is changing each time when load the page. So to handle this situation instead of using find element by Id, we can use find element by Xpath.

Advantages of Selenium RemoteWebDriver

It allows for the execution of Automation test suites or batches on multiple machines at the same time It enables test case execution with browsers that are not available on the current OS. In simple terms, it is OS-independent. It returns an exception with an accompanying screenshot so testers know what issue has occurred. It allows testing of a web application on a remote server, even before making it live. Hence, local testing saves time and cost with early bug detection.

Challenges with explicit wait strategies?

It applies to a particular element unlike implicit waits that are applied to the whole session. So when applying explicit waits we need to think of reusability. We can have some global timeouts set up and just using them depending on the type of the interaction.

How to run tests in cloud with ci/cd?

It depends on the complexity of the test framework and how many resources we have for this goal. We can use docker with selenium grid if we need to have a huge parallel testing job including cross browser testing for example. If we don't need to have that complex system, then we can run tests in parallel on a single powerful agent by creating a job in our ci/cd provider like Azure or Jenkins that is triggered whenever we have a new build. In my current company we only use this option for now, so I didn't have an opportunity to work with docker and related technologies.

To use page factory or not?

It is just a matter of preference, it doesn't have any real practical advantages or disadvantages but the code looks nicer in my opinion when when using it.

List out a few common Json Parsing Techniques used in Rest Assured Automation?

Json Path Deserialization of Json using POJO Classes

Traversing to a Particular Element in JSON Response

JsonPath jsonPath = new JsonPath(response); String elementValue = jsonPath.getString("path.to.element");

What are the limitations of css selectors?

Locating element by part of the Inner Text. It cannot be used for locating elements with their visible text available between opening and end tags.

Java Concepts in Test Framework

Method Overriding: Redefining a superclass method in a subclass, used to provide specific implementations. Method Overloading: Having multiple methods with the same name but different parameters, used for flexibility in calling methods. Abstract Class and Interface: Used for defining a contract for subclasses and for multiple inheritance, respectively. They can define the structure without implementing all details. HashMap Usage: Often used to store unique elements as key-value pairs, useful for managing data sets like test data or element locators.

Do you prefer XPath or CSS selectors?

Most of the time we go with css, we use xpath only when we cannot reliably identify by css selector.

How do you decide whether it is a frontend bug or a backend bug.. what things do you check so that you know it.

Network Inspection: Use browser developer tools to inspect network requests and responses. Errors or unexpected responses indicate backend issues, while correct responses with issues rendering or processing data suggest frontend bugs. Log Analysis: Server and application logs can indicate backend problems. Lack of errors suggests the issue may be frontend. Isolation Testing: Try to reproduce the issue using direct API calls (for potential backend issues) or static mockups (for frontend). Consistency Check: If the issue occurs across different clients or browsers, it's likely a backend issue. Browser-specific issues often point to frontend problems.

Problems with selenium

No support for non web items. For example if our application generates some pdf or csv we cannot scan and verify what has been generated. Or in one of our applications we have a feature where an employee needs to pass a face recognition in the application before accessing it, we didn't develop this ourselves but there is no way to automate this feature for example.

Areas Where We Cannot Use Explicit Wait in Selenium

Non-DOM Changes: Explicit waits are designed to wait for changes within the DOM (Document Object Model). If you're waiting for something that doesn't affect the DOM (like a file to download), explicit waits won't be effective. Browser Alerts: Selenium's explicit wait mechanism cannot be used to wait for browser-level alerts or pop-ups since they are not part of the DOM. Instead, you would use WebDriver's Alert interface to interact with them. Page Load Completion: Although Selenium provides a way to wait for page load completion to a certain extent, explicit waits are not designed to verify that all elements on a page have fully loaded, especially for elements loaded asynchronously via JavaScript after the initial page load. You would need to target specific elements or conditions to ensure the page is fully loaded. Network Traffic: Waiting for network calls to complete, such as AJAX or API calls made by the application, cannot be directly achieved using explicit waits unless these calls result in a detectable change in the DOM. External Processes: Operations that happen outside the web browser, such as interactions with the operating system, external applications, or the file system, are beyond the scope of explicit waits.

What is POJO, serialization and de-serialization?

POJO (Plain Old Java Object): A simple Java object that does not extend or implement specific frameworks' classes and interfaces. In the context of APIs, POJOs are often used to model the request and response structures. Serialization: The process of converting a POJO (or any object) into a format that can be easily stored or transmitted (e.g., converting a Java object into a JSON string for an API request). Deserialization: The reverse process of serialization, where data in a format like JSON is converted back into a Java object. This is commonly used to interpret responses from API calls.

What is Page factory?

Page Factory is a class provided by Selenium WebDriver to support Page Object Design patterns. In Page Factory, testers use @FindBy annotation. The initElements method is used to initialize web elements. @FindBy: An annotation used in Page Factory to locate and declare web elements using different locators.

How would you change the nested part of the JSON in API Automation

Parsing and Modifying: Use a JSON parsing library (like Jackson for Java or json for Python) to deserialize the JSON into a map or custom object, modify the nested part, and serialize it back to JSON. Direct Manipulation: For simple changes, directly manipulate the JSON string or use JSONPath expressions to update nested values.

How to handle stale element exception?

Re-locate the Element When you catch a stale element exception, try to re-locate the element. This means you should locate the element again within the catch block or retry mechanism before performing any actions on it. Make sure the page is refreshed. If the element becomes stale because the page is being dynamically updated, sometimes refreshing the page and then re-locating the element can be a straightforward workaround.

What is Json Serialization & Deserialization in Rest Assured

Serialization in Rest Assured context is a process of converting a Java object into Request body (Payload) Rest Assured also Supports deserialization by converting Response body back to Java object

List out few Authentication Techniques used in API's?

Session/Cookie Based Authentication Basic Authentication with login and password Tokens

How to avoid stale element exceptions?

Stale Element Exceptions occur when an element that was previously located becomes disconnected from the DOM or gets refreshed. To avoid them: Use explicit waits with expected conditions (e.g., ExpectedConditions.elementToBeClickable) to ensure the element is present and interactable before performing actions. Catch the StaleElementReferenceException and re-locate the element using a fresh findElement call if it occurs. Avoid storing WebElement objects for an extended period; re-fetch them as needed. Make sure your tests account for dynamic content and page updates that may affect element references.

Handling OAuth 2.0 in RestAssured

String accessToken = given() .formParam("client_id", "YOUR_CLIENT_ID") .formParam("client_secret", "YOUR_CLIENT_SECRET") .formParam("grant_type", "client_credentials") .post("https://example.com/oauth/token") .then() .extract() .path("access_token"); given() .auth() .oauth2(accessToken) .when() .get("https://example.com/secured/api") .then() .statusCode(200);

DDT in selenium?

TestNG data providers for JSON filer or Excel spreadsheets

What is TestNG.xml, difference b/w @BeforeTest and @BeforeMethod?

TestNG.xml is a configuration file used in TestNG to define a suite of tests that you want to run. This file allows you to specify the test classes, groups, methods, parameters, and other configurations that TestNG should execute. It provides a centralized place to manage your tests, making it easier to organize, maintain, and scale your testing suite. Differences between @BeforeTest and @BeforeMethod: @BeforeTest: This annotation is used to specify a method that will be executed before any test method belonging to the classes inside the <test> tag is run in the TestNG.xml file. It is useful for setting up prerequisites for a group of tests at a test level, rather than at a suite or method level. @BeforeMethod: This annotation is used to specify a method that will be executed before each test method. It's useful for setting up prerequisites for each test method individually, such as initializing variables or configuring test environment settings.

What is DOM?

The DOM, or Document Object Model, is a programming interface for web documents. It represents the page so that programs can change the document structure, style, and content. The DOM represents the document as a hierarchical tree of objects; each object corresponds to a part of the document's structure (e.g., an element, attribute, or piece of text). When a web page is loaded, the browser creates a DOM of the page, which serves as an object-oriented representation of the web page itself. Through the DOM, programming languages like JavaScript can interact with the page, making it possible to dynamically change document structure, style, and content. For example, with the DOM, JavaScript can: - Add, remove, or modify elements and attributes. - Change styles directly, affecting the presentation of elements. - Respond to user actions like clicks or keypresses. - Create dynamic and interactive experiences, such as updating content without reloading the page (AJAX). The DOM is not part of the JavaScript language, but rather a Web API (Application Programming Interface) provided by browsers for JavaScript to interact with. It's standardized by the World Wide Web Consortium (W3C) and the Web Hypertext Application Technology Working Group (WHATWG) to ensure consistent behavior across different web browsers.

What does the command git config do?

The git config command is a convenient way to set configuration options for defining the behavior of the repository, user information and preferences, git installation-based configurations, and many such things.

What is the problem with Thread.Sleep in code?

Theard.sleep() introduces a definite wait(that is fixed periods of inactivity) no matter what happens, which will slow down our test, and if you are using CI(Continuous integration) generally result take much time if we use it all over the place.

While running a script, you are getting "NoSuchElementException". But you have taken the correct locator(ID, XPATh or CSS). Still you are facing the same issue. What might be the reason?

There could be several reasons for encountering a "NoSuchElementException" even when using the correct locator (e.g., ID, XPath, or CSS): Timing Issue: The web element might not have loaded on the page yet when the script tries to access it. You can use explicit or implicit waits to handle this. Element within an iframe: If the element is inside an iframe, you need to switch to the iframe context using driver.switchTo().frame() before locating the element. Incorrect Page Load: Ensure that the page is fully loaded before attempting to interact with elements. Dynamic Content: The element might be dynamically generated or modified by JavaScript. In such cases, you may need to wait for a specific condition using WebDriverWait. Incorrect Locator: Double-check the locator strategy, spelling, and the element's attributes to make sure it's accurate.

How to achieve Parallel Execution using TestNG?

To achieve parallel execution of test methods using TestNG, you can follow these steps: Annotate your test methods with @Test. Configure the parallel attribute in the TestNG XML suite file to specify the level of parallelism (e.g., parallel="methods"). Run your tests using the TestNG framework. TestNG will automatically execute your test methods in parallel based on the configuration specified in the XML suite file.

Lets say you are testing a service and you make a post call and then the service goes down .. now you want to debug what caused your service to go down so what will be your debugging steps

To debug a service that goes down after a POST call, consider these steps: Check Logs: Review server and application logs for errors or exceptions that occurred around the time of the failure. Reproduce the Issue: Try to reproduce the issue in a controlled environment with detailed logging enabled. Analyze Payload: Examine the payload of the POST request to ensure it meets the expected format and doesn't contain data that could cause a crash (e.g., unexpected characters, sizes). Monitor Resources: Check system and application metrics for unusual resource usage spikes or limits being hit. Dependency Check: Verify if external dependencies or services were accessible and functioning correctly at the time of the issue. Debugging Tools: Utilize debugging tools or features in your IDE to step through the code and identify the exact point of failure.

How would you send attachments to API using Rest Assured Test?

Using MultiPart method

Handling WebTable with Pagination

To handle a web table with pagination, iterate through the pages by locating the pagination controls. On each page, interact with the table as needed (e.g., reading values, clicking links). This might involve a loop where you check for the existence of a "next" button or page numbers.

What are the differences between API testing and UI testing?

UI (User Interface) testing means the testing of the graphical user interface. The focus of UI testing is on the look and feel of the application. In user interface testing the main focus is on how users can interact with app elements such as images, fonts, layout etc. are checked. API testing allows the communication between two software systems. API testing works on backend also known as backend testing.

what are the different exceptions you have seen in UI and Backend ? And then how do you debug that?

UI Exceptions often include: ElementNotVisibleException: Element is present but not visible. Debug by ensuring the element is within the viewport and not obscured. NoSuchElementException: Target element could not be found. Debug by checking the locator strategy and timing issues (element not yet rendered). Backend Exceptions often include: NullPointerException: Attempting to use an object reference that has the null value. Debug by checking object initializations. OutOfMemoryError: The JVM runs out of memory. Debug by analyzing memory usage and leaks. Debugging Approach: Use detailed logs and exception messages to pinpoint the issue. For UI, verify element selectors and wait conditions. For backend, use a profiler for performance issues or inspect code for logical errors.

How do you handle asynchronous loads on a page?

Use explicit waits

How to make tests atomic?

Using api and cookies NEVER USE SELENIUM TO GENERATE APPLICATION STATE FOR PRECONDITION OF THE TEST CASE!!!

How would we define API details in Rest Assured Automation?

We define all the request details and Send it to sever in GIVEN, WHEN , THEN methods

What if need to construct element at the runtime because this element is dynamically generated?

We will need to have a method for locating this element that will return class By as a return type and we will provide required data as a parameter and this data will be used to construct the locator.

Remote WebDriver vs. WebDriver

WebDriver: WebDriver is a component of Selenium that allows you to automate web browsers for testing and other purposes. It provides a programming interface to interact with web elements and perform actions like clicking, typing, and navigating web pages on a local machine. Remote WebDriver: Remote WebDriver extends the functionality of WebDriver by allowing you to control web browsers running on remote machines or devices. It enables distributed testing, where your test scripts run on one machine (the client) and interact with browsers on another machine (the server). This is useful for cross-browser testing and testing on different operating systems.

How to read Excel data through hash map?

You can read Excel data into a HashMap in Java using a library like Apache POI. Here's a general outline of how to do it: Open the Excel file using FileInputStream and create an instance of Workbook (HSSFWorkbook or XSSFWorkbook depending on the Excel format). Iterate through the rows and columns of the desired sheet. For each row, create a HashMap where keys represent column headers, and values represent cell values. Add each HashMap to a list or use a HashMap where the row index is the key. Close the Excel file input stream when finished.

What exactly needs to be verified in API testing?

accuracy of the data. HTTP status code. Authorization would be check. Non-Functional testing such as performance testing, security testing.

Differentiate between git pull and git fetch?

git fetch retrieves changes from the remote repository and stores them in your local repository. However, it does not automatically merge or apply these changes to your working directory or current branch, allowing you to review and decide how to integrate changes.git pull combines two operations: git fetch and git merge (or git rebase depending on your configuration).It fetches changes from the remote repository and immediately tries to integrate them into your current working branch. It effectively updates your working directory with the remote changes.

Can you tell the differences between git revert and git reset?

git revert creates new commits to undo changes while preserving commit history, making it safe for collaborative workflows.git reset moves the branch pointer and can rewrite commit history, making it powerful but potentially disruptive, and it should be used with caution, primarily for local branches.

What are Path Parameters and Query Parameters for below API request URL

in "http:/rahulshettyacademy.com/orders/1234?location=IND" queries use "?" symbol

What are listeners in TestNG?

it's an interface that allows us to customize certain behavior of the testing framework usually for logging and reporting purposes.

ID vs name

name is not unique to this element

examples of selenium exception

no such element, element not intractable, stale element

how to handle stale element exception?

we can add exception handling to the method where it happens and try to relocate the element after certain period of time

В Xpath как работать с элементами которые так просто не отображается и даже не присутствуют в DOM, а появляются только после нажатия куда то?

В таком случае надо писать раздельно - сначала для нажатия нужной кнопки, а потом для того что возникает после этого.

How to handle a situation when pages have a lot of common elements? Should we put them all in the base page class?

Нет, потому что тогда наш базовый класс станет огромным, надо выделать компоненты в отдельные классы, прописывать там всю логику работы с ними и в page objects уже использовать их как поля класса. Это кстати хороший пример про конфликт разных principles, типа выбрать dry или kiss или srp, потому что в данном случае они все взаимоисключающие.


Related study sets

LMFT Clinical Exam - Practice Exam VI (TDC-II) ヽ(〃·◇·)ノ

View Set

JAVA INTERVIEW QUESTIONS 1-) BEHAVIORAL QUESTIONS

View Set

Retail Operations Exam 3 - Langston 2020

View Set

Criminology Unit 2 AC2.2 INDIVIDUALISTIC THEORIES

View Set

NCLEX Practice Health Assessment 2

View Set

504 Absolutely Essential Words - English defenition

View Set