# Codekru > Blogging website for learners ## Posts - [Browser Commands in Selenium Webdriver Java](https://www.codekru.com/selenium/browser-commands-in-selenium-webdriver-java): When you manually browse the web, you don’t just interact with buttons or text fields on a page. Your interaction starts much earlier: you launch the browser application, type a URL into the address bar, resize the window to see content clearly, or use the “Back” and “Forward” arrows to navigate through your history. Finally, when you are finished, you close the specific tab or shut down the browser entirely. In test automation, Browser Commands are the specific instructions that replicate these high-level browser actions. They are the foundational layer of any Selenium script. Before your code can find a […] - [Run Your First Selenium Script in Java](https://www.codekru.com/selenium/your-first-selenium-java-script): Welcome to the world of Test Automation! If you are reading this, you are likely standing at the edge of manual testing, looking to leap into automation. Writing your first script is a rite of passage. It changes how you view software quality – shifting from repetitive manual clicking to building intelligent “robots” that do the work for you. This guide is designed for absolute beginners. We will move slowly, explain every concept, and use the modern approach (Selenium 4.x) that avoids the complex configurations of the past. By the end of this article, you will have a working script […] - [What is Selenium? Architecture & Components](https://www.codekru.com/selenium/what-is-selenium-architecture-components): In today’s fast‑paced digital world, websites and web applications are updated frequently. Manually testing these changes is time‑consuming, error‑prone, and simply not scalable. This is where Selenium comes in. Selenium is a widely used open‑source automation testing framework designed specifically for automating web browsers. It allows testers and developers to simulate real user interactions – clicking buttons, filling forms, navigating pages, and verify that web applications behave as expected. However, a programming language cannot “talk” to a browser directly. They speak different languages. To make automation possible, Selenium uses a sophisticated Architecture that acts as a translator and messenger. At […] - [How to Run Playwright Java Tests in Parallel?](https://www.codekru.com/playwright/how-to-run-playwright-java-tests-in-parallel): If you’ve worked with Playwright, you already know it’s one of the most powerful modern automation tools for browser testing. Developed by Microsoft, Playwright supports cross-browser automation for Chromium, Firefox, and WebKit, and it’s gaining huge traction for end-to-end web testing. While Playwright shines with speed, reliability, and cross-browser support, many Java developers quickly notice one major limitation when using it standalone: Playwright (by itself) doesn’t support running tests in parallel out of the box. Note: Playwright’s Node.js library has its own runner, but not in Playwright Java So, when you’re using Playwright with Java, you need a test runner […] - [How to Run Selenium Tests in Parallel Using TestNG](https://www.codekru.com/testng/how-to-run-selenium-tests-in-parallel-using-testng): In today’s fast-paced software development world, speed and efficiency in testing are no longer optional, they are must-haves. Running tests sequentially often becomes a bottleneck when test suites grow larger. Imagine having hundreds (or even thousands) of test cases and waiting hours for execution to complete. This is where parallel test execution in TestNG comes into play. TestNG, a powerful testing framework for Java, offers built-in support for parallel execution of tests, making it possible to run multiple tests simultaneously. This reduces execution time, maximizes resource utilization, and helps teams get faster feedback. In this article, we’ll cover everything you […] - [How to generate exact TPS/RPS Using Jmeter](https://www.codekru.com/jmeter/how-to-generate-exact-tps-rps-in-jmeter): When running performance tests with Apache JMeter, one of the most common goals is to generate traffic at a controlled rate, often measured in Transactions Per Second (TPS) or Requests Per Second (RPS). For example, if your SLA requires your system to handle 10 TPS, you need to configure JMeter so that it consistently sends exactly 10 transactions every second. But achieving precise TPS is not always straightforward. JMeter, by default, is designed to simulate virtual users (threads) executing requests as fast as possible, which may not align with your target throughput. Without proper configuration, your test might either overshoot […] - [Handle Alert, Popup and Dialogs Using Playwright Java](https://www.codekru.com/playwright/handle-alert-popup-and-dialogs-using-playwright-java): When automating web applications with Playwright in Java, one common challenge testers face is dealing with alerts, popups, and dialog boxes. These are browser-level interruptions that require user action, such as clicking OK, choosing Cancel, or entering text before proceeding further. If these are not handled properly, your automation scripts can get stuck and fail. In this article, we’ll explore in detail how to handle alerts, confirm dialogs and prompts in Playwright Java. We’ll break down the logic behind dialog handling, cover multiple scenarios, and explain best practices so you’ll never get stuck when your application throws an unexpected popup. […] - [Upload and Download Files Using Playwright Java](https://www.codekru.com/playwright/upload-and-download-files-using-playwright-java): When automating web applications with Playwright in Java, file upload and download scenarios are among the most common test cases you will encounter. From attaching a profile picture to downloading a PDF report, understanding how to handle file interactions in Playwright ensures your automation covers real-world workflows. In this article, we’ll cover: Throughout this article, we will use our testing playground website – https://testkru.com/Elements/Files, to demonstrate how to upload and download files Uploading Files in Playwright Java For uploads, Playwright doesn’t interact with the OS file picker. Instead, it directly sets the file(s) to an <input type=”file”> element in the […] - [Launch Browsers in Playwright Java With Examples](https://www.codekru.com/playwright/launching-browsers-in-playwright-java-with-examples): When working with Playwright Java for browser automation and testing, one of the most essential steps is launching a browser instance before interacting with a web application. Playwright supports three main browser engines out of the box: The beauty of Playwright is that it provides a single API to work with all three, making cross-browser testing smooth and consistent. In this article, we will cover: By the end, you’ll be able to confidently launch any browser in Playwright Java and know exactly which options to choose for your tests. Installing Playwright Java dependencies Before we can launch browsers with Playwright […] - [Handling Checkboxes and RadioButtons in Playwright Java](https://www.codekru.com/playwright/handling-checkboxes-and-radiobuttons-in-playwright-java): When automating web applications, interacting with checkboxes and radio buttons is a common yet crucial task. Whether you are testing a signup form, a survey, or a settings page, handling these UI elements correctly ensures reliable and bug-free automation scripts. In Playwright Java, interacting with these elements requires understanding how to locate them accurately, change their state, and verify that the intended action was successful. In this post, we will cover everything you need to know about handling checkboxes and radio buttons in Playwright. One key advantage of Playwright over Selenium is its built-in action methods, which automatically handle element […] - [How to Locate Elements in Playwright Java](https://www.codekru.com/playwright/how-to-locate-elements-in-playwright-java): If you’re diving into Playwright for Java automation and wondering “How do I locate elements accurately?”, you’re in the right place. Locating elements is the foundation of any UI automation. If you get this wrong, your scripts will be flaky, hard to maintain, and bound to break. In this guide, we’ll explore all the different locator strategies in Playwright Java, along with examples. Table of Contents What is a Locator in Playwright Java? A locator is an object that identifies a specific web element on the page, such as: In Playwright Java, we use the Locator class to find elements. […] - [How to Read Data from Excel in TestNG and Selenium](https://www.codekru.com/testng/how-to-read-data-from-excel-in-testng-and-selenium): When building test automation frameworks with Selenium WebDriver and TestNG, one of the most common challenges is managing large sets of input data. Hardcoding values into test methods may work for small-scale tests, but for enterprise-level or real-world automation, this approach quickly becomes unscalable and brittle. To solve this, we often turn to data-driven testing, where test inputs are maintained in external files, and Excel is a favourite among QA engineers due to its flexibility and widespread use. Note: We have also attached a video at the end of this article. In case you are more comfortable with the video version, then […] - [Constant Throughput Timer in Jmeter with examples](https://www.codekru.com/jmeter/constant-throughput-timer-in-jmeter-with-examples): In performance testing with Apache JMeter, maintaining a consistent request rate is often crucial to simulate real-world user behavior and to identify how an application performs under a specific load. The Constant Throughput Timer (CTT) is a built‑in JMeter element designed precisely for this purpose. In this article, we will cover the Constant Throughput Timer (CTT) of JMeter in detail with examples. What we will learn: What Is the Constant Throughput Timer in JMeter? The Constant Throughput Timer (CTT) is a JMeter Timer element that regulates the pace at which requests (samples) are sent, enforcing a fixed throughput, measured in samples per […] - [Can we use implicit and explicit waits together?](https://www.codekru.com/selenium/can-we-use-implicit-and-explicit-waits-together): If you’ve spent any time automating tests with Selenium WebDriver, you’ve probably run into the dreaded “NoSuchElementException” – usually because Selenium tried to interact with an element before it was ready. To deal with such timing issues, Selenium provides wait mechanisms to synchronize your test script with the browser. The two most common types of waits are implicit wait and explicit wait. Note: We have also attached a video at the end of this article. In case you are more comfortable with the video version, then please feel free to have a look But here’s a question that often comes up in […] - [Wait for element to disappear in Selenium Java with Examples](https://www.codekru.com/selenium/wait-for-element-to-disappear-in-selenium-java-with-examples): When automating web applications using Selenium, it is common to encounter elements such as loading spinners, pop-ups, or toast messages that appear temporarily and then disappear. Waiting for these elements to disappear is crucial before moving to the next step; otherwise, your script may fail due to premature actions. In this article, we’ll explore how to wait for an element to disappear using Selenium in Java. We’ll cover different approaches and share hands-on code examples to make everything crystal clear. Waiting in Selenium Selenium provides various ways to wait for elements, such as Implicit Waits, Explicit Waits, and Fluent Waits, […] - [HTTP Request Sampler in Jmeter with Examples](https://www.codekru.com/jmeter/http-request-sampler-in-jmeter-with-examples): If you’ve just started with Apache JMeter, one of the most essential components you’ll come across is the HTTP Request Sampler. It’s the workhorse when it comes to testing the performance of web applications, APIs, and services over HTTP. In this guide, we’ll break down what the HTTP Request Sampler is, how to use it, and provide a hands-on example to help you get started – even if you’ve never used JMeter before. What is an HTTP Request Sampler? The HTTP Request Sampler is a crucial component in JMeter used to send HTTP/HTTPS requests to a server. It allows you […] - [Selenium Locators Speed Test: Fastest to Slowest](https://www.codekru.com/selenium/selenium-locators-speed-test-fastest-to-slowest): When writing Selenium automation tests, selecting an efficient locator strategy directly impacts how quickly and reliably your tests run. We all want our tests to be fast, stable, and easily maintainable. A common question testers often ask is: “Which locator performs the fastest in Selenium?” In this article, we’ll experimentally verify the performance of various locator strategies – ID, Name, CSS Selector, and XPath. Additionally, we’ll delve deeper into XPath itself, comparing different XPath expressions based on complexity. Why Locator Performance Matters in Selenium? When automation scripts scale to hundreds or thousands of elements, each millisecond counts. Slow locators: Hence, […] - [Parametrized Tests in Pytest ( data driven testing )](https://www.codekru.com/pytest/guide-to-parametrized-tests-in-pytest-data-driven-testing): When we write tests for code, we’re often faced with repeating the same tests multiple times, just with different inputs and expected results. Writing separate tests each time makes our test suites bulky, hard to maintain, and prone to errors. This is where parametrized tests – also known as data-driven testing – come to your rescue. In this article, we’ll explore parametrized tests in Pytest in detail. We will walk through their significance, implementation, and practical examples that clearly demonstrate how you can leverage this powerful feature in real-world projects. Let’s discuss them one by one. What are parametrized tests? […] - [How to capture console logs in Selenium Python?](https://www.codekru.com/selenium-python/how-to-capture-console-logs-in-selenium-python): When working with automated UI tests, one often overlooked but incredibly valuable aspect is browser console logs. Capturing console logs using Selenium in Python helps you identify JavaScript errors, warnings, or any custom logs that might be affecting your application’s functionality or performance. In this article, we’ll walk through how to capture console logs in Selenium Python. Why Capture Console Logs? Before jumping into the how-to, let’s understand the why: Capturing console logs To start with, let’s see how to view the console logs. Open this link: https://testkru.com/TestUrls/TestConsoleLogs. Then, right-click anywhere on the page and select ‘Inspect‘ to open the […] - [How to enter text in a text box using appium?](https://www.codekru.com/appium/how-to-enter-text-in-a-text-box-using-appium): Whether you’re building a login screen test or filling out forms, one of the most common interactions you’ll deal with is entering text into input fields. In this article, we’ll walk through different ways to enter text in a text box using Appium, with code examples. Throughout our example, we will try to fill in the highlighted element below with the value “codekru“. This element is present at our playground website – https://testkru.com/Elements/TextFields. Here are a couple of ways to fill in the text box using Appium: Let’s take a look at each option, one by one. WebElement.sendKeys() method WebElement […] - [get_attribute vs get_property vs get_dom_attribute](https://www.codekru.com/selenium-python/get_attribute-vs-get_property-vs-get_dom_attribute-which-one-to-use): You might have noticed a few Selenium methods in Python that seem quite similar: get_attribute, get_property, and get_dom_attribute. So, which one should you use, and what’s the difference between them? Each of these methods works a little differently, and the best choice depends on what you’re trying to do. Let’s break it down! So, which one to use? Now that we know what each method does, which one should we use? Okay, we won’t be using get_attribute(), but how can we then decide between get_dom_attribute() and get_property()? Well, for that, we first need to understand the difference between an attribute […] - [get_dom_attribute() method in Selenium Python](https://www.codekru.com/selenium-python/get_dom_attribute-method-in-selenium-python): When working with Selenium for web automation, one of the most common tasks is extracting attributes from HTML elements. Selenium provides multiple ways to retrieve attributes, and one of the lesser-known but powerful methods is get_dom_attribute(). Attributes provide extra information about elements, and every tag can have certain attributes that describe it in more detail. These attributes are typically defined as key-value pairs ( except boolean attributes ). Like we have the type and id attribute on the input tag Here, type and id are the attribute keys, while “text” and “firstName” are their corresponding values. So, the get_dom_attribute() method […] - [get_property() method in Selenium Python](https://www.codekru.com/selenium-python/get_property-method-in-selenium-python): Selenium has been the go-to tool for web automation for years, but even experienced testers sometimes get confused about when to use get_property() versus get_attribute(). If you’ve ever struggled with retrieving dynamic properties from web elements, get_property() is the method you need to understand, whereas we have covered get_attribute() in a different post. This post will discuss the get_property() method in detail. Now, you might be wondering—what exactly is a “property”? A property is a characteristic of a DOM (Document Object Model) element that represents its current state in memory. Properties are part of the JavaScript object model and can […] - [How to get the text of an element in Appium?](https://www.codekru.com/appium/how-to-get-the-text-of-an-element-in-appium): When automating mobile web applications using Appium, extracting text from elements is a crucial task. Whether you need to validate page content, retrieve dynamic data, or perform assertions, getting text reliably is essential. In this guide, we’ll explore how to get the text of an element using Appium. We will get the text of the element highlighted below. This element is present at this page – https://testkru.com/Elements/TextMessages Using getText() method First, we’ll set the desired capabilities to launch the browser. While we’ll be using the iOS simulator, the same approach also works for the Android simulator. Output – Using getDomProperty() […] - [How to retry the failed test cases in PyTest?](https://www.codekru.com/pytest/how-to-retry-the-failed-test-cases-in-pytest): When working with automated testing in Python, PyTest is one of the most popular and powerful testing frameworks. However, in real-world scenarios, tests can sometimes fail due to transient issues—network latency, database unavailability, or even slight timing mismatches. Manually rerunning failed test cases is time-consuming and inefficient. Fortunately, PyTest provides built-in capabilities to automatically rerun failed tests, ensuring robustness and efficiency in test execution. In this article, we’ll explore why rerunning failed test cases is essential, how to do it in PyTest, and the different ways to implement it effectively. Why Do We Need to Retry Failed Test Cases? Automated […] - [How to setup Appium with the andrioid/ios simulators on Mac](https://www.codekru.com/appium/how-to-setup-appium-with-the-andrioid-ios-simulators-on-mac): In today’s fast-moving world of mobile app development, ensuring your app runs smoothly across different devices is more important than ever. Appium, a powerful open-source automation framework, makes this easier by allowing developers and testers to automate applications on both Android and iOS using a single codebase. Unlike platform-specific testing tools, Appium supports multiple programming languages like Java, Python, and JavaScript, offering flexibility and efficiency. While setting up Appium with Android and iOS simulators may seem complex at first, the right approach makes it much simpler. This guide will walk you through the entire process – installing dependencies, configuring emulators […] - [How to generate random strings or number in Jmeter](https://www.codekru.com/jmeter/how-to-generate-random-strings-or-number-in-jmeter): When performing load testing in JMeter, generating random strings or numbers is crucial for simulating real-world scenarios. Whether you need dynamic user credentials, unique request parameters, or randomized data to prevent caching issues. This article will explore different methods to generate random strings and numbers in JMeter. So, let’s look at all the ways one by one. Generate random number using ${__Random()} Jmeter provides a ${__Random()} function, which we can use to generate random numbers. ${__Random()} takes three arguments ${__Random()} will generate a random number between its minimum and maximum values. So, if we want to generate a random number […] - [How to group test cases in PyTest](https://www.codekru.com/pytest/how-to-group-test-cases-in-pytest): When working with pytest, organizing and grouping test cases efficiently can make test execution smoother and debugging much easier. Pytest offers various ways to categorize and run tests selectively, whether you’re dealing with unit tests, integration tests, or end-to-end scenarios. This article explores multiple ways to group test cases in pytest and how to execute them effectively. Why Grouping Test Cases is Important Ways to Group Test Cases in Pytest and Execute Them Pytest offers several flexible ways to group test cases: Let’s look at all of them one by one Using markers Pytest provides markers to categorize tests. We […] - [How to run your first test with Pytest?](https://www.codekru.com/pytest/how-to-run-your-first-test-with-pytest): If you’re new to Python testing, you’ve probably heard of Pytest – a lightweight and powerful testing framework that makes writing and running tests simple and enjoyable. Whether you’re a developer ensuring code quality or diving into automated testing, Pytest is a fantastic choice. In this post, we’ll walk you through running your first test with Pytest, step by step. As per Wikipedia – Pytest is a Python testing framework that originated from the PyPy project. It can be used to write various types of software tests, including unit tests, integration tests, end-to-end tests, and functional tests. Its features include parametrized testing, fixtures, and assert re-writing. But why to use PyTest So, let’s start […] - [Guide to Thread Group in Jmeter with Examples](https://www.codekru.com/jmeter/guide-to-thread-group-in-jmeter-with-examples): If you’re new to JMeter, one of the first concepts you’ll encounter is the Thread Group. It’s a core feature that plays a vital role in performance testing, and understanding it is the key to creating accurate and effective test plans. So, what exactly is a Thread Group? Think of it as the foundation of your JMeter test. It’s where you set up the number of virtual users (called threads) interacting with your application, how often they will perform actions, and how long the test will run. Essentially, the Thread Group helps you simulate real-world user behavior to check how […] - [Throughput Controller in Jmeter with examples](https://www.codekru.com/jmeter/throughput-controller-in-jmeter-with-examples): In performance testing, simulating real-world user behavior is essential to accurately evaluate an application’s capacity and responsiveness. The Throughput Controller in Apache JMeter plays a pivotal role in achieving this realism by controlling the frequency of specific actions within a test plan. It allows testers to distribute the load intelligently, ensuring that test scenarios reflect the varying behavior of users interacting with the application. Imagine having three APIs; we can distribute the workload among them by assigning 40% of the requests to the first API and 30% each to the second and third APIs. Note: We have also attached a video at […] - [Create custom annotation that adds a method in the same class like lombok's](https://www.codekru.com/java/create-custom-annotation-that-adds-a-method-in-the-same-class-like-lomboks): Annotations are everywhere in modern Java development. You’ve likely seen them in frameworks like Spring (@RestController, @Autowired), JPA (@Entity, @Table), or testing tools like JUnit (@Test, @BeforeEach). These annotations simplify code, abstract complex logic, and help developers focus on core functionality. Today, however, we will shift gears. Instead of exploring existing annotations, we’ll learn how to create a custom one – an annotation capable of generating methods, similar to how Lombok’s @Getter and @Setter work. But it’s easier said than done. Creating an annotation that will create a method at runtime is not easy. One has to know how compilation […] - [Assertions in TestNG](https://www.codekru.com/testng/assertions-in-testng): When we are writing tests, the goal isn’t just to run the code but to make sure it’s doing what we expect. That’s where assertions come in – they let us confirm that our code behaves as it should. In TestNG, assertions play a key role, helping us verify if our expected outcomes match the actual results in the code. Let’s dive into how assertions work in TestNG, the types available, and why we should use them to make our tests as effective as possible. Note: We have also attached a video at the end of this article. In case […] - [What is testng.xml file and how to run cases using XML?](https://www.codekru.com/testng/what-is-testng-xml-file-and-how-to-run-cases-using-it): This post will discuss testng.xml file, what it is, why we should use it, and how we can execute our cases using XML files. Note: We have also attached a video at the end of this article. In case you are more comfortable with the video version, then please feel free to have a look What is a testng.xml file? testng.xml is a configuration file used to organize and execute test cases. It lets us define which tests to run, in what order, and even what parameters to pass. So, we can think of it as a playlist for our test cases. Most […] - [SDET interview experience at LambdaTest](https://www.codekru.com/interviews/sdet-interview-experience-at-lambdatest): Although I was rejected in the first round itself, I believe my experience could be helpful for those preparing for similar interviews at reputable product-based companies. It could provide valuable insights into what to expect and how to prepare for the interview process at such companies. A bit about me I have almost 3.5 years of experience in the testing domain and have worked with Java, Selenium, TestNG, etc. I was looking for a senior role in the company and found a good opportunity at LambdaTest. How did I get selected for the interview? I have uploaded my resume to […] - [is_enabled() method in Selenium Python](https://www.codekru.com/selenium-python/is_enabled-method-in-selenium-python): As the name suggests, the is_enabled() method is used to check whether an element is enabled or not. This post will delve into the details of using the is_enabled() method on various elements. Let’s use the is_enabled() method on the highlighted element in the below image. This element is present on our Selenium playground website: https://testkru.com/Elements/Buttons. We can use the find_element() method in Selenium Python to locate the element with the “disabledButton” id. Then, we can use the is_enabled() method to check whether the button is enabled or not. Whole code Output – We can see that the function returned […] - [How to get test case details at runtime in TestNG?](https://www.codekru.com/testng/how-to-get-test-case-details-at-runtime-in-testng): This post will discuss how to obtain details of a test case at runtime. We might require this information in various scenarios, such as creating customized reports or developing a live tracking system to monitor test case progress. Let’s begin by running a test suite using TestNG. Then, we will try retrieving the details of each test case when it is marked as passed or failed. Executing a test suite Making two test classes We will make two test classes, CodekruTest1 and CodekruTest2. CodekruTest1.java CodekruTest2.java Executing these two classes via testng.xml We will use the testng.xml file to run the […] - [How to double-click on an element in Selenium Python?](https://www.codekru.com/selenium-python/how-to-double-click-on-an-element-in-selenium-python): Sometimes, when working with web applications, we may encounter various scenarios where we need to double-click on a particular element to perform some actions. A common example of this is when we use document editors, where we may need to double-click on text elements to activate editing mode or to view formatting options. This post will explore a couple of ways to perform double-clicks on elements using Selenium in Python. Let’s see both of them one by one Using ActionChains ActionChains class in Selenium Python provides a method named double_click(), which is specifically used for double-clicking on an element. This […] - [is_displayed() method in Selenium Python](https://www.codekru.com/selenium-python/is_displayed-method-in-selenium-python): is_displayed() method in Selenium Python is used to check whether the element is visible to the user or not. This post will discuss the is_displayed() method in detail. Code Examples Using is_displayed() on a visible element Let’s pick the highlighted element in the image below. This element is present on our playground website – https://testkru.com/Elements/TextMessages. As we can see, the element is visible, so the is_displayed() method should return true. Whole code Output – We can see that the is_displayed() method returned true. Let’s try a case where the element is not visible on the webpage. Using is_displayed() on a […] - [Right-click on an element using Selenium Python](https://www.codekru.com/selenium-python/right-click-on-an-element-using-selenium-python): There are certain situations where we need to perform a right-click action on a button or an element and choose from the dropdown options that appear. It may be necessary to perform similar actions while writing automated test scripts as well. In this post, we will discuss how to carry out a right-click action on an element using Selenium and Python. This will allow you to effectively simulate user actions and interactions during test automation. We will use the ActionChains class in Selenium Python to right-click on the element. It provides a context_click() method, which helps perform right-click user action […] - [click() method in Selenium Python](https://www.codekru.com/selenium-python/click-method-in-selenium-python): click() method in Selenium Python is used to click on the specified element, and this post will discuss it in detail using Selenium and Python. Note: click() method performs a left click. Code Example Let’s try to click on the highlighted element below. This element is present on our playground website – https://testkru.com/Elements/Buttons. We can see that the element id’s is “leftClick“, and use it to find the element using find_element() method. then, we can use the click() method to click the button. Whole Code Above code will click on the button, which is also indicated by the change in […] - [send_keys() method in Selenium Python](https://www.codekru.com/selenium-python/send_keys-method-in-selenium-python): The send_keys() method in Selenium Python is a useful tool that can be used to automate typing into an element. This method is particularly helpful when interacting with web pages that require user input, like filling out forms or entering text into input fields. In this post, we will take a detailed look at the send_keys() method and its functionality. Typing into an input field Let’s take an example of the below-highlighted element present on the page – https://testkru.com/Elements/TextFields where we will try to type “codekru”. We can find the element with the help of the find_element() method using its […] - [How to get the placeholder text using Selenium Python?](https://www.codekru.com/selenium-python/how-to-get-the-placeholder-text-using-selenium-python): Most of the input fields in our system have a text prompt inside them called a “placeholder.” This placeholder provides instructions or examples of the type of information that should be entered into that particular field. It helps users understand what data is expected of them and ensures that the information entered is accurate and consistent. As a tester, we may encounter scenarios where we need to verify the placeholder of an input field, and this post will cover various ways to get the placeholder text of an input field using Selenium and Python. Let’s discuss both ways one by […] - [get_attribute() method in Selenium Python](https://www.codekru.com/selenium-python/get_attribute-method-in-selenium-python): get_attribute() method in Selenium Python is used to get the value of a given property or attribute. This post will discuss the get_attribute() method in detail. get_attribute() first attempts to return the value of a property with the specified name that is passed as its argument. If the property does not exist, the function returns the value of an attribute with the same name. If neither a property nor an attribute with the given name can be found, the function returns ‘None’. Attribute vs Property Attributes provide additional information about the elements, and all tags can have attributes that provide […] - [How to get the hidden text of an element in Selenium Python?](https://www.codekru.com/selenium-python/how-to-get-the-hidden-text-of-an-element-in-selenium-python): Sometimes, while working with web pages, we may encounter situations where we have to verify the content of hidden text. However, using the text property in Selenium only retrieves the text that is visible to the user, not the hidden text. This can be a challenge for testers who want to validate the hidden text for their test cases. So, this post will cover various ways of retrieving hidden text in Selenium using Python. Let’s look at them one by one. Using get_attribute() method The textContent property allows retrieving the hidden text of an element and its descendants. Therefore, by […] - [How to get the text of an element in Selenium Python?](https://www.codekru.com/selenium-python/how-to-get-the-text-of-an-element-in-selenium-python): This post will discuss various ways of getting the text of an element using Selenium and Python. Please note that here, we are talking about the visible text only, not the hidden text. ( Please read this post to get the hidden text of an element ) The visible text means the text that is visible on the webpage and not hidden using any CSS property. Here, “This is a text” is visible on the webpage, and the same would also be returned by the methods explored in this post The text is not visible on the webpage; thus, the methods we will […] - [Get network call requests in Selenium Python](https://www.codekru.com/selenium-python/get-network-call-requests-in-selenium-python): When a user interacts with a web application, the application sends multiple requests to a server to fetch data or perform actions. These requests are called network calls, and they contain critical information that can help developers debug and optimize the application. In this post, we will discuss how to use Selenium and Python to extract useful information from network calls such as request headers, request payload, etc. Manually capture the network calls We can access the developer tools in modern web browsers to capture and view network calls by right-clicking on the webpage and selecting the “inspect” option. Clicking […] - [Get network call responses in Selenium Python](https://www.codekru.com/selenium-python/get-network-call-responses-in-selenium-python): Network calls are integral to web applications, enabling communication between a user’s browser and a web server. This communication facilitates the exchange of data that powers dynamic and interactive online experiences. These calls involve requests and responses, where the browser sends a request to the server to retrieve data, and the server responds with the necessary information. In this post, we will discuss how to use Selenium and Python to retrieve the responses of those calls. Manually capture the network calls We can access the developer tools in modern web browsers to capture and view network calls by right-clicking on […] - [value_of_css_property() method in Selenium Python](https://www.codekru.com/selenium-python/value_of_css_property-method-in-selenium-python): The value_of_css_property() method in Selenium Python is used to retrieve the value of a CSS property for an element. Validating CSS properties like color, font weight, and background color can assist us in verifying various scenarios. This post will discuss in detail how we can retrieve various CSS property values using the value_of_css_property() method. Syntax of using value_of_css_property() method – Note: The value_of_css_property() method will return the color values as  RGBA strings. E.g., If the “background-color” property is set as “green”, then value_of_css_property(“background-color”) would return “rgba(0, 255, 0, 1)” instead of “green. “ Code Example We will try to get […] - [Debug sampler in Jmeter](https://www.codekru.com/jmeter/debug-sampler-in-jmeter): When creating or modifying a test plan, we often need to debug our scripts to ensure that we get the desired results. This is particularly true when working with complex scripts that involve many components and variables. Fortunately, JMeter has a Debug sampler that makes it easy to debug scripts. This tool allows us to view the values of all JMeter variables and properties, which can then be seen in the Response Data tab of the “View Results Tree” listener. We will create a test plan and execute the “https://jsonplaceholder.typicode.com/posts/1” API while analyzing the variables we will create and extract […] - [Saving responses to a CSV file in Jmeter](https://www.codekru.com/jmeter/saving-responses-to-a-csv-file-in-jmeter): Note: We have also attached a video at the end of this article. In case you are more comfortable with the video version, please feel free to have a look When you’re running a load test with hundreds or thousands of requests, it’s not practical to manually inspect each one in the JMeter GUI or even in the .jtl file. Here’s why exporting responses to a CSV file can be helpful: Let’s first execute a dummy API (“https://jsonplaceholder.typicode.com/posts/1“) and then we will save the result of this API in a CSV file. Executing the API Set Up a Test Plan Create a Thread […] - [Reading from CSV file in Jmeter ( Using "CSV Data Set Config")](https://www.codekru.com/jmeter/reading-from-csv-file-in-jmeter-using-csv-data-set-config): There are times when you need to run performance tests with varying input data – that’s where data-driven testing in JMeter comes in handy. Instead of creating separate tests for each data set, you can use a CSV file to manage all your input values. JMeter allows you to read data from a CSV file and run tests dynamically with different parameters. This approach makes your tests more flexible and scalable. In this post, we’ll walk through how to read data from a CSV file in JMeter. Note: We have also attached a video at the end of this article. In case you […] - [Loop Controller in Jmeter](https://www.codekru.com/jmeter/loop-controller-in-jmeter): The Loop Controller is one of the Logic controllers in JMeter, allowing a particular section of the Test Plan to be executed repeatedly in a single iteration. This post will discuss the Loop controller in detail. A loop controller is useful when a user needs to repeat certain steps. It allows the execution of child elements multiple times, such as samplers and other controllers. We will follow the below steps to use the Loop controller in our Test Plan Let’s look at above steps one by one. Set up a Test Plan Create a Thread Group The Thread Group is […] - [Detailed Test Cases for API Testing](https://www.codekru.com/manual-testing/detailed-test-cases-for-api-testing): API testing plays a crucial role in software quality assurance. Whether you work for a company that delivers robust software solutions or are preparing for a software testing interview, you may encounter a situation where you need to make cases for an API. This article will discuss various test cases that can be used while working with an API. These test cases will be presented in a structured manner, moving from a broad view to a more granular view for easy comprehension. The image below illustrates the various aspects of API testing using which we will make our test cases. […] - [Response Assertion in Jmeter](https://www.codekru.com/jmeter/response-assertion-in-jmeter): Response Assertion is a powerful tool that ensures the accuracy of response parameters during load testing. It allows you to verify response codes, data, and other variables, ensuring that your application is functioning properly under heavy loads. By using Response Assertion, you can identify potential issues before they become critical problems, helping you to deliver a high-quality product to your customers. This article will discuss the Response Assertion in detail, along with examples. We will execute an API and then assert its response and other fields using Response Assertion. This process will allow us to gain a better understanding of […] - [JSR223 Assertion in Jmeter](https://www.codekru.com/jmeter/jsr223-assertion-in-jmeter): JSR223 Assertion allows us to create custom validation rules using scripting languages like Groovy, JavaScript, and more. This article will discuss the JSR223 Assertion in detail. During load tests, testers can utilize JSR223 Assertion to make use of scripting languages such as Groovy, JavaScript, and Beanshell. This enables them to create validation logic for the responses received. The flexibility provided by JSR223 Assertion is particularly useful when dealing with complex scenarios or dynamic content that cannot be verified effectively using JMeter’s built-in assertion components like Duration Assertion or JSON Assertion. Benefits of using JSR223 Assertion Let’s move on to show […] - [JSON Assertion in Jmeter with Examples](https://www.codekru.com/jmeter/json-assertion-in-jmeter): JSON is a popular format used for exchanging data between a server and a client. Due to its widespread use in APIs and web services, it is crucial to ensure the accuracy of JSON responses when testing such systems. This is where the JSON Assertion in JMeter comes into play, providing a reliable means of verifying the correctness of JSON responses. JSON Assertion is a powerful tool used to verify various aspects of a JSON response. With this tool, we can ensure that the response meets the required standards. JSON Assertion provides a wide range of features that can check […] - [Duration Assertion In Jmeter](https://www.codekru.com/jmeter/duration-assertion-in-jmeter): The Duration Assertion or we can say response time assertion in Jmeter, is used to verify the response time of HTTP requests, JDBC requests, and other transactions. It allows us to set the maximum time limit for response times. If the response time exceeds the defined threshold, the assertion will fail, indicating performance issues that need to be addressed. Let’s first make a simple test plan which we can use to demonstrate the functioning of Duration Assertion. Add an HTTP request We will hit an HTTP request to “jmeter.apache.org” and then will measure its performance using the Duration Assertion. Create […] - [How to check if a button is clicked in Playwright Java](https://www.codekru.com/playwright/how-to-check-if-a-button-is-clicked-in-playwright-java): Detecting button clicks is a fundamental aspect of web development, and this article will explore how to know if a button is clicked or not using Playwright Java. There is no built-in function in Playwright to determine if a button was clicked. So. we will be creating our own implementation. We will navigate to our playground website – https://testkru.com/Elements/Buttons and click on the highlighted button in the image. Then, we will check whether it was clicked both before and after clicking it. Inspecting the highlighted button will reveal its DOM. We will use the id ( “leftClick” ) of the […] - [Transfer files from one remote server to another using Java](https://www.codekru.com/java/transfer-files-from-one-remote-server-to-another-using-java): Previously, we discussed transferring files from local machines to remote servers, and this post will focus on copying or transferring files between remote servers. We will use the JSch library to connect and transfer the files from one remote server to another. To transfer files, we will proceed with the following steps – Let’s look at the above steps one by one. Add Jsch dependency in the pom.xml file Add the below dependency in your pom.xml file Connect to the remote servers We have created a separate post detailing the process of connecting to a remote server. Below, we have provided the […] - [Saving responses to an Excel file in Jmeter](https://www.codekru.com/jmeter/saving-response-to-an-excel-file-in-jmeter): In the dynamic landscape of software performance testing, Apache JMeter emerges as a stalwart, allowing engineers to rigorously assess the robustness and efficiency of applications, particularly APIs. This article will discuss the process of skillfully saving API responses to an Excel file using Jmeter. We will follow below steps to save an API response in an Excel file. Let’s follow the above steps one by one. Set Up a Test Plan Create a Thread Group The Thread Group is used to execute a specific number of tests. For simplicity, we will keep it set at 1. Please refer to the […] - [keyboard.press() method in Playwright Java](https://www.codekru.com/playwright/keyboard-press-method-in-playwright-java): The press() method offers an effective means of simulating key presses, allowing us to automate and test different scenarios within web applications. This article will delve into the press() method’s specifics. press() method has two overloaded implementations – Let’s look at both of them one by one. default void press(String key) Syntax of using the Keyboard’s press() method Code Example Let’s try to press the “Enter” key. We can test it on our playground website to see which key is being pressed. We can see from the above image that “Enter” was pressed. What if we pass an unknown key […] - [keyboard.type() method in Playwright Java](https://www.codekru.com/playwright/keyboard-type-method-in-playwright-java): The “keyboard.type()” method helps in efficiently automating user actions and interacting with web elements. This article will provide a detailed exploration of this method. The “type()” method in Playwright is designed to mimic the act of typing on a keyboard. It sends a series of characters to a web page’s active element, such as an input field, textarea etc. There are two overloaded implementations of the type() method provided by the Playwright – Let’s look at them one by one. default void type(String text) It accepts a text as an argument and sends the same to the active element. It […] - [keyboard.up() method in Playwright Java](https://www.codekru.com/playwright/keyboard-up-method-in-playwright-java): Earlier, we discussed the keyboard.down() method that dispatches a keydown event ( means a key will remain pressed until it is released). This article will delve into the keyboard.up() method in Playwright Java, exploring its functionality and how it contributes to seamless web automation. What does keyboard.up() method do? Syntax of using keyboard.up() method? Code Example We will use our playground website to showcase the use of the up() method. Usually, the keyboard.up() method is used after the keyboard.down() method to release a key after holding it down. In our example, we will use the down() function to press and […] - [keyboard.down() method in Playwright Java](https://www.codekru.com/playwright/keyboard-down-method-in-playwright-java): One of the essential features of Playwright Java is the keyboard.down() method. This method allows us to simulate user interactions with keyboard inputs accurately. Whether it’s pressing a single key, handling key modifiers, or emulating continuous key presses, keyboard.down() offers a wide array of possibilities to enhance the realism and accuracy of test scenarios. This article will dive deep into the capabilities of the keyboard.down() method in Playwright Java. A list of keyboard keys can be found on this page – https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_key_values. When is the keydown event triggered? When a key is pressed, the keydown event is triggered. The key […] - [How to get network call responses in Playwright?](https://www.codekru.com/playwright/how-to-get-network-call-responses-in-playwright-java): Understanding and capturing network call responses becomes indispensable for validating test outcomes, monitoring API interactions, and extracting valuable data when automating web applications. This article will delve into the intricacies of fetching network call responses in Playwright using Java. Most modern web browsers have built-in developer tools that allow us to view and capture network calls. We can access the developer tools by right-clicking on the webpage and selecting the “inspect” option. Selecting the “Inspect” option will open the browser developer tools, where we can see a bunch of tabs. Select the “Network” tab to see and capture the network […] - [How to get network call requests in Playwright?](https://www.codekru.com/playwright/how-to-get-network-call-requests-in-playwright-java): When a user uses a web application, the browser and server exchange HTTP requests and responses. These network calls are important for fetching data, loading resources, and executing application logic. It is necessary to manage and understand these network calls for several reasons, like debugging and optimizing performance. In this article, we will discuss how to use Java to get network call requests in Playwright. We can easily capture network requests or logs using the browser developer tools. Most modern web browsers have built-in developer tools that allow us to view and capture network requests. We can access the developer […] - [How to take screenshots using Playwright Java?](https://www.codekru.com/playwright/how-to-take-screenshots-using-playwright-java): Capturing screenshots is an essential task for various purposes, such as bug reporting, documentation, and website testing. Playwright provides a user-friendly approach to capture screenshots programmatically in Java. This article will explore how to take screenshots using Playwright in Java, enabling us to automate this process and enhance testing and debugging workflows. We will delve into the following topics – Let’s discuss them one by one. Capture a screenshot of the whole webpage In Playwright, the Page interface offers a screenshot() method that enables us to capture a screenshot of our page and save it to any location on our […] - [Integrate Playwright with TestNG](https://www.codekru.com/playwright/integrate-playwright-with-testng): The Java testing framework, TestNG, is a reliable and adaptable tool that streamlines the process of creating, executing, and reporting tests. To complement TestNG’s capabilities, Microsoft’s Playwright browser automation library offers a unified API for cross-browser testing. By utilizing the strengths of both TestNG and Playwright, developers and QA professionals can enhance their web testing efforts and achieve seamless functionality, increased productivity, and faster delivery of high-quality software solutions. In this article, we will explore the seamless integration of Playwright and TestNG. We’ll guide you through the process step-by-step and also demonstrate the integration by executing a test case. We’ll […] - [Wait for Element to Disappear in Playwright Java](https://www.codekru.com/playwright/wait-for-element-to-disappear-in-playwright-java): In the world of web automation, waiting for specific elements to appear or disappear is a common scenario. One essential requirement is to wait for an element to disappear before proceeding with further actions. In this article, we will explore effective techniques to wait for an element to disappear in Playwright Java. We will use the below-highlighted elements. These elements are present on our playground website – https://testkru.com/Interactions/DisappearingElements. Three highlighted elements will vanish at different intervals. The first one will disappear in 5 seconds, the second in 10 seconds, and the third in 15 seconds. Now, we will look at […] - [evaluate() method in Playwright Java](https://www.codekru.com/playwright/evaluate-method-in-playwright-java): The evaluate() method in Playwright for Java provides a mechanism to execute JavaScript code within the context of a web page. It allows us to interact with the Document Object Model (DOM) and manipulate elements, retrieve data, and perform complex operations that go beyond the built-in functions of Playwright. This post will delve into the depths of the evaluate() method and discuss it in detail. Page interface provides two overloaded evaluate() methods – One method accepts only one argument, whereas the second method accepts two arguments. Passing only a single argument in the evaluate() method The evaluate() method can execute […] - [findElements method equivalent in Playwright](https://www.codekru.com/playwright/findelements-method-equivalent-in-playwright): If you’re familiar with locating elements on a web page using Selenium’s findElement() and findElements() methods but are now using Playwright Java, you may be curious about the equivalent method that provides the same functionality. This article will explore Playwright Java’s equivalent of these methods and how they can improve your web automation workflows. When it comes to locating elements, there are multiple strategies available, including XPath and ID. The above-listed methods can utilize these strategies, and it would be beneficial for Playwright’s method to allow commonly used ones like XPath, ID, and CSS selectors. The Playwright method, locator(), functions […] - [Find elements using XPath selectors in Playwright Java](https://www.codekru.com/playwright/find-elements-using-xpath-selectors-in-playwright-java): XPath is a powerful and versatile language for locating elements within web pages. In the world of web automation, understanding XPath and its usage can greatly enhance your ability to locate elements with precision and reliability. This article will dive into locating elements using XPath in Playwright Java. We have a detailed post on Xpath that explains the different types of Xpaths and how to write them for an element. We encourage you to read it to gain a clear understanding of Xpath. Now, let’s start locating or locating the element by using the XPath expressions. Playwright provides various methods […] - [Playwright Mobile Emulation Using Java](https://www.codekru.com/playwright/playwright-mobile-emulation-using-java): One of the standout features of Playwright is its mobile emulation capabilities, allowing one to simulate and test websites on various mobile devices. This article will explore leveraging Playwright’s mobile emulation functionality using Java, enabling us to perform comprehensive mobile testing and ensure responsive designs across different devices. Before delving into simulating mobile device conditions using Playwright, let’s first explore how we typically accomplish this through a browser’s developer tools. How to simulate mobile conditions using developer tools? Right-click on the webpage and select the inspect option from the list. This will open up the developer tools, and then we […] - [How to get the title of a Page Using Playwright Java?](https://www.codekru.com/playwright/how-to-get-the-title-of-a-page-in-playwright-java): The page title carries important information that can be used for verification, validation, or further processing in your automated scripts. This article explores how to extract the page title using Playwright Java. There are a few methods available to retrieve the title of a page, as outlined below. Let’s discuss them one by one. title() method title() method of the Page interface is one of the most commonly used methods to retrieve the title of a Page. For our example, let’s refer to this page ( https://testkru.com/Elements/TextFields ) titled “Text Fields“. We’ll attempt to retrieve it by utilizing the title() […] - [Handling Windows and Tabs Using Playwright Java](https://www.codekru.com/playwright/handling-windows-and-tabs-using-playwright-java): Handling windows and tabs is a crucial aspect of browser automation, and Playwright Java provides powerful capabilities to manage them effectively. This article will discuss about handling windows and tabs using Playwright Java. Let’s look at them one by one. Open a new window using Playwright In Playwright, a browser context typically corresponds to a window. Therefore, utilizing a browser context allows for managing multiple windows. Making an instance of a browser Create a new browser context which represents a window Creating a Page and navigating to the URL To open a new window, create a new browser context. We […] - [Switching to a frame Using Playwright Java](https://www.codekru.com/playwright/switching-to-a-frame-in-playwright-java): Frames are commonly used in modern web applications to embed content from different sources, and being able to interact with them is crucial for accurate testing and data extraction. This post will focus on interacting with frames and extracting important information from them. The following points will be discussed. Switching to a child frame There are several methods to switch to a frame, as outlined below: Let’s look at them one by one. For simplicity, we will choose the below-highlighted frame and try switching to it using our methods. You can find the below element on our playground website – […] - [How to get the CSS property value in Playwright Java?](https://www.codekru.com/playwright/how-to-get-the-css-property-value-in-playwright-java): When it comes to web testing and automation, one of the most frequent tasks is retrieving CSS property values. But extracting these values manually can be error-prone and time-consuming. Playwright offers robust tools that simplify this process and allow for efficient CSS property value retrieval. Although Playwright doesn’t provide a straightforward way to obtain a CSS property value, we can utilize the evaluate() method to execute javascript code and retrieve the CSS property value. Javascript provides a getComputedStyle() method, which gets an HTML element’s computed CSS properties and values. We can use the same to retrieve any CSS property value. […] - [isChecked() method in Playwright Java](https://www.codekru.com/playwright/ischecked-method-in-playwright-java): isChecked() method in Playwright checks whether a radio button or a checkbox is selected. This post will discuss Playwright’s isChecked() method in detail and will see the working examples using Java. The isChecked() method is available through the Page, Locator, and ElementHandle implementations. However, it is advisable to use the implementation provided by the Locator. Locator provides two overloaded isChecked() method – Let’s discuss them one by one. default boolean isChecked() The isChecked() function will indicate whether a checkbox or radio button has been selected by returning true. It will return false if it is not selected. We will check […] - [How to get the cookie value in Playwright Java?](https://www.codekru.com/playwright/how-to-get-the-cookie-value-in-playwright-java): Cookies are small pieces of data stored in a user’s web browser while browsing a website. Cookies can be used for various purposes, such as identifying users, storing user preferences, and tracking user activity. This article will focus on getting a cookie value in Playwright using Java. Create a BrowserContext and a new Page We can create a new browser context using the browser.newContext() and a new page using the browserContext.newPage() method. Navigating to the URL Please go to the website address for which you need to retrieve the cookies. Get all cookies BrowserContext provides us with a cookies() method […] - [click() method in Playwright Java](https://www.codekru.com/playwright/click-method-in-playwright-java): The click() method in Playwright Java is a powerful tool for automating user interactions with web applications. With just a few lines of code, you can simulate a user clicking on a web page’s button, link, or other element. This article will discuss the click() method provided by the Playwright in detail using Java. Several implementations of the click() method are offered by the Page, Locator, and ElementHandle. However, it is advisable to use the Locator’s click() method, which we will focus on in this discussion. Locator provides two overloaded click() methods. Let’s discuss them one by one. default void […] - [How to capture console logs using Playwright Java?](https://www.codekru.com/playwright/how-to-capture-console-logs-using-playwright-java): You might have faced situations where you want to capture console logs from a website or application. Console logs can provide valuable insights into the performance, behaviour, and errors of your website or application. This article will discuss capturing console logs using Playwright Java, a powerful tool for automating web browser interactions. Playwright provides “page.onConsoleMessage()” method to intercept and handle console messages. This method takes a callback function whenever a console message is logged on the page. Below line of code will print every message shown on the browser console. We’ll use one of our Playwright playground URLs ( https://testkru.com/TestUrls/TestConsoleLogs […] - [How to pass parameters to a DataProvider in TestNG?](https://www.codekru.com/testng/how-to-pass-parameters-to-a-dataprovider-in-testng): In TestNG, DataProviders provide parameters for test methods, enabling them to run the same test with various data sets. But what if we need to pass parameters to a DataProvider from a test method? How can we achieve this? There are several methods to achieve this goal, and one of them involves utilizing annotations. So, what are annotations? Annotations serve as metadata to provide supplementary information about classes, interfaces, variables, methods, or fields. However, they do not directly impact the functioning of the code they are applied to. Annotations start with “@”. There are many annotations in TestNG, like @Test, […] - [How to get the placeholder text in Playwright Java?](https://www.codekru.com/playwright/how-to-get-the-placeholder-text-in-playwright-java): When filling out a form, you may notice a small text hint in the input field or textarea. That is called the placeholder attribute, and it provides a brief description of the information that is expected to be entered. For example, the input field for last name may display the placeholder text “Enter your last name…” which will disappear once a value is entered. Today’s discussion will focus on acquiring placeholder text for an element through Playwright Java. We can use the following techniques to accomplish this task. Let’s discuss them one by one. Using getAttribute() method We have created […] - [getAttribute() method in Playwright Java](https://www.codekru.com/playwright/getattribute-method-in-playwright-java): The getAttribute() method is a useful tool for retrieving an element’s attribute value, such as a link’s “href” or an image’s “src”. With this method, you can easily check attribute values and take actions based on them. Whether you’re dealing with dynamic web pages or testing user interfaces, having a solid understanding of the getAttribute method is crucial for efficient automation. In this post, we’ll dive into the details of Playwright’s getAttribute() method using Java. Attributes are typically presented in the form of key-value pairs. For instance, the <input> tag possesses the type and id attributes. type and id are […] - [innerText() vs textContent() in Playwright](https://www.codekru.com/playwright/innertext-vs-textcontent-in-playwright): When working with web elements in Playwright, knowing the difference between innerText() and textContent() methods is important. While both methods return the text content of an element, they differ in how they handle whitespace and non-textual elements. This article will explore the differences between innerText and textContent in Playwright and discuss how to use them effectively in your tests. innerText() vs textContent() textContent() can retrieve the text content of the hidden elements, whereas innerText() cannot. Let’s see this with one example. We will take the below-highlighted element and use innerText() and textContent() on it. You can find this element at […] - [How to click an element in Playwright Java?](https://www.codekru.com/playwright/how-to-click-an-element-in-playwright-java): When automating web applications, clicking on an element is one of the most common actions that testers and developers perform. Playwright, a modern automation library for web browsers, provides a simple and efficient way to interact with web elements, including clicking on them. This post will cover ways to click an element in Playwright using Java. We will use the below-highlighted element as an example and click on it. You can find this element at https://testkru.com/Elements/Buttons. Inspecting the element will reveal its DOM. Now, let’s discuss the methods one by one. Using click() method Playwright has its click() method that […] - [innerHTML() method in Playwright Java](https://www.codekru.com/playwright/innerhtml-method-in-playwright-java): innerHTML() method in Playwright is used to retrieve the HTML content of an element’s descendants. This post will discuss the innerHTML() method in detail using Java. There are multiple implementations of the innerHTML() method in Playwright, but it is recommended to use the Locator’s implementation of the innerHTML() method. Locator has two overloaded implementations of the innerrHTML() method – Let’s discuss them one by one. default String innerHTML() It returns the HTML content of the element’s descendants. Let’s try this on the below-highlighted element. You can find this element on https://testkru.com/Elements/TextMessages Let’s inspect the highlighted element. We can see that […] - [innerText() method in Playwright](https://www.codekru.com/playwright/innertext-method-in-playwright): innerText() method in Playwright is used to retrieve the visible text of a web element and its sub-elements. This post will discuss the innerText() method in detail using Java. What do we mean by visible text and sub-elements? Visible text The visible text means human-readable text on the webpage, which is not hidden by using any CSS property. The innerText() method would return an empty string for the hidden text or element. innerText() method would return “This is a text” string. The innerText() method would return an empty string because the element is hidden. Sub-elements An HTML document is made […] - [textContent() method in Playwright](https://www.codekru.com/playwright/textcontent-method-in-playwright): textContent() method in Playwright, as the name suggests, is used to retrieve the text content of an element on a web page. This method is useful for web scraping and verifying the content of a page. This post will cover the textContent() method of the Playwright in detail. The textContent() method has many implementations, but Playwright suggests using the Locator implementation of the textContent() method, so we will only discuss the Locator textContent() implementation. There are a few points to note about the textContent() method – Locator provides us with two overloaded implementations of the textContent() method – Let’s look […] - [isEditable() method in Playwright Java](https://www.codekru.com/playwright/iseditable-method-in-playwright-java): The isEditable() method in Playwright Java is used to determine whether an element is editable or not on a web page. This method can be very useful in test automation, as it can ensure that only the expected fields can be modified by users. This article will discuss on how to use the isEditable() method in Playwright Java and how it can help write reliable and robust automated tests for web applications. According to the documentation, an element is considered editable when it is enabled and does not have readonly property set. Multiple interfaces have declared the isEditable() method in Playwright – Page, Locator, […] - [hover() method in Playwright Java](https://www.codekru.com/playwright/hover-method-in-playwright-java): This article will discuss the hover() method in Playwright using Java to simulate hovering over an element in web automation. This article covers everything you need to know about the hover() method, including how to use it, what it does, and how it can help you automate web interactions efficiently. Many interfaces in Java have declared the hover() method – Page, Locator and ElementHandle. Playwright recommends using the Locator hover() method, so we will discuss only the Locator implementation of the hover() method in this article. The Locator provides two overloaded implementations of the hover method. Let’s look at them […] - [isEnabled() method in Playwright Java](https://www.codekru.com/playwright/isenabled-method-in-playwright-java): isEnabled() method in Playwright tells whether an element is enabled, and this post will discuss the isEnabled() method in detail. According to the documentation, the element is considered enabled unless it’s a <button>, <select>, <input> or <textarea> with disabled property. There are multiple implementations of the isEnabled() method in Playwright. Out of the above implementations, it is recommended to use the Locator implementation as per the playwright documentation. The Playwright altogether discourages the use of ElementHandle. According to their documentation The use of ElementHandle is discouraged, use Locator objects and web-first assertions instead. – from Playwright Let’s look at them one by one. Page isEnabled() method The Page in […] - [Introduction to Page in Playwright Java](https://www.codekru.com/playwright/introduction-to-page-in-playwright): One of the most essential components in Playwright Java is the Page object. If you’re just getting started with Playwright, understanding the role of the Page object is crucial for writing stable and efficient tests. In this article, we’ll take a closer look at the Page and how it works. What is a Page in Playwright? In Playwright, a Page represents a single tab or window in a browser. Think of it like a browser tab that you interact with – you can navigate to URLs, click elements, type into inputs, and much more. Technically speaking: In Playwright Java, Page […] - [How to get the text of an element using the Playwright?](https://www.codekru.com/playwright/how-to-get-the-text-of-an-element-using-the-playwright): This post will discuss various ways of getting the text of an element using Playwright. Here, we will only talk about the visible text on the webpage, not the hidden text. We will get the text of the below-highlighted element. This is located at the URL – https://testkru.com/Elements/TextMessages. Using innerText() method innerText() method returns the visible text of an element and its descendants. Let’s try to get the element’s text highlighted in the image above. Output – Using textContent() method textContent() and innerText() methods appear similar, but there are a few differences between them, and you can choose the one […] - [How to double click on an element using Playwright?](https://www.codekru.com/playwright/how-to-double-click-on-an-element-using-playwright): Playwright is a powerful Java library for automating web browser interactions and performing various actions on web pages. One common action is double-clicking on a button. We can double-click on a button using a couple of ways – We will use our selenium playground website to double-click on the below-highlighted button. The button is present on the page – https://testkru.com/Elements/Buttons. Using dbClick method Playwright provides a dbClick() method to double-click on a specific element. We will locate the highlighted element and double-click it using the dbClick() method. So, let’s inspect the highlighted element to find the locator we can use. […] - [Selenium Java: How to switch to iframes](https://www.codekru.com/selenium/selenium-java-how-to-switch-to-iframes): Iframes, also known as inline frames, embed another document within the current HTML document. Iframes are mostly used to embed third-party content into the HTML, and we might come across a scenario where we have to automate the content contained within an iframe. An iframe is represented by a <iframe> tag. While we automate iframes, one cannot directly locate elements within an iframe. We have to first switch to an iframe, or we can say, go inside an iframe, and only then will we be able to locate and automate the elements. There are various methods available to switch to […] - [How to hover over an element in Selenium Webdriver?](https://www.codekru.com/selenium/how-to-hover-over-an-element-in-selenium-webdriver): Hovering over an element is a common scenario when automating a web application. For E.g. info is shown as a tooltip after hovering over an element. So, this post will discuss how we can automate such scenarios where hovering is required on elements. We will use the below-highlighted element on our selenium playground website – https://testkru.com/Elements/Buttons. Actions class provides a moveToElement() method that moves a mouse pointer to the middle of the specified element. This simulates the hover behaviour for the web element, so we will use it to hover over the highlighted element. Hovering over an element is a […] - [clickAndHold() method in Selenium Java with Examples](https://www.codekru.com/selenium/clickandhold-method-in-selenium-java-with-examples): clickAndHold() method in Selenium helps simulate clicking and to hold down the mouse button on an element. It’s part of the Actions class, which provides a way to perform complex user interactions with the web page. This post will discuss the clickAndHold() method of the Actions class in detail. Actions class has two overloaded implementations of the clickAndHold() methods – public Actions clickAndHold(WebElement target) public Actions clickAndHold() Let’s look at each of the methods one by one. We will use our selenium playground website to click and hold one of the boxes on the page – https://testkru.com/Interactions/DragAndDrop. Let’s pick Box 1 and will try to […] - [moveToElement() method in Selenium Java with Examples](https://www.codekru.com/selenium/movetoelement-method-in-selenium-java-with-examples): moveToElement() method in Selenium helps move a mouse cursor to a specific element on the webpage. It’s part of the Actions class, which provides a way to perform complex user interactions with the web page. This post will discuss the moveToElement() method of the Actions class in detail. Actions class provides two implementations of the moveToElement() method – public Actions moveToElement(WebElement target) public Actions moveToElement(WebElement target, int xOffset, int yOffset) Let’s discuss them one by one. public Actions moveToElement(WebElement target) It moves the mouse to the middle of the element passed in the argument. Let’s pick one element from our […] ## Pages - [Appium Java](https://www.codekru.com/appium) - [PyTest Tutorials](https://www.codekru.com/pytest) - [Selenium Python Tutorials](https://www.codekru.com/selenium-python-tutorials): Introduction & Setup WebElement functions Handling various elements DevTools with Selenium Locators in Selenium - [JMeter Tutorials](https://www.codekru.com/jmeter): Guide to Thread Group in Jmeter with Examples Samplers Assertions Controllers Timer Misc - [Playwright Java Tutorials](https://www.codekru.com/playwright): Page Methods in Playwright Finding elements Handling various elements Keyboard actions DevTools with Playwright Misc - [Selenium Java Tutorials](https://www.codekru.com/selenium): Introduction & Setup Locators in Selenium Basic Web Element Interactions Handling specific elements Waits Actions Class in Selenium Chrome Devtools with Selenium Misc - [Maven Tutorials](https://www.codekru.com/maven): How to create and run a Maven project using the command line Maven build Goals, Plugins, Lifecycle, and Phases All about Maven Build Lifecycle Maven Coordinates and Repositories How to execute unit test cases using Maven? How to ignore test failures while building projects in maven? How to skip unit test cases in a maven project? How to integrate Maven with TestNG - [Go Language Tutorials](https://www.codekru.com/go-language): Go Basics Hello World program in Golang Golang Data Types GoLang keywords Variables in Go Language How to take inputs from users in Go Language? Go Control Statements Go Language: If-Else Control Structures Go Language: Understanding and Using For Loops Go Functions and Methods Functions in Go Language Blank Identifier( underscore ) in GoLang Variadic functions in Golang Methods in Golang ( Golang methods ) Does Golang support method overloading? Arrays and Slices Arrays in Go Language How to sort an array in Golang? How to reverse an array in Golang? Golang Slices How to sort a slice in Golang? […] - [Learn TestNG: Step-by-Step Tutorials (Articles + Videos)](https://www.codekru.com/test-ng): Misc TestNG annotations @Test annotation attributes - [SQL](https://www.codekru.com/sql) - [Spring](https://www.codekru.com/spring) - [Spring Boot](https://www.codekru.com/spring-boot) - [Java](https://www.codekru.com/java): Linked List Jackson Annotations Lombok Regular Expression Strings Java ArrayList Vector Jsch OOPS concepts Wrapper classes Basics How to run Java programs using the command prompt ( cmd ) Conversions - [Codekru | Blogging Website for learners](https://www.codekru.com/): Be part of our crew (Kru) We constantly bring new articles about various tools and technologies. Subscribe to our newsletter and be part of this awesome crew. Choose your crew - [About Us](https://www.codekru.com/about-us): What is codekru ? Codekru is a blogging website for learners in the engineering field where we write blogs and articles about various concepts and technologies in the field of engineering. This website is made for the sole purpose of reaching a large number of people with easy writing of blogs and articles and help them understand the difficult concepts in a quite easy manner. How to contact us ? Well, this is the most easy part, just fill below form with your message and we will reach you soon. [comment]: # (Generated by Hostinger Tools Plugin)