Thanks again Raghav! These tutorials with step by step hands on training are awesome!!
@RaghavPal4 ай бұрын
Most welcome Rashmi.. keep learning
@Varun-A Жыл бұрын
Your tech teaching style is really effective. I'm learning so much
@RaghavPal Жыл бұрын
Happy to hear that Varun
@peterluxus73823 жыл бұрын
The best series on Selenium I have yet seen!!!
@RaghavPal3 жыл бұрын
Thanks a lot Peter, humbled
@RaghavPal3 жыл бұрын
Hi, I will suggest that you watch this basic Selenium playlist - kzbin.info/aero/PLhW3qG5bs-L_s9HdC5zNshE5Ti8jABwlU
@RaghavPal3 жыл бұрын
Selenium is used to Automate browser actions and its scope is within the browser only, I will try to add a more detailed video
@atkuriajaykumar37012 жыл бұрын
Thankyou so much raghav ,like you explained everything like how to identify element using name locator, and sending some text into identified locator, and how to store and print single and multiple web elements, and about different locators available and tips for using them and for css selectors for I'd we need to use # and class we need to use * , and also you explained about selenium 4 relative locators and types , Thanks raghav really you are sharing really amazing stuff with absolutely no fee and helping people like me . Thanks a ton !
@RaghavPal2 жыл бұрын
Hi Ajay, most welcome
@narminetouihri31053 жыл бұрын
I love learning selenium 4 this way Very intresting Thank you very much
@RaghavPal3 жыл бұрын
Glad you are enjoying it Narmine
@pranali20523 жыл бұрын
Thanks Raghav. Waiting for more video's.
@RaghavPal3 жыл бұрын
Very soon Pranali
@jannatulnayeem68582 жыл бұрын
Thanks a lot for uploading interesting topics on Selenium 4
@RaghavPal2 жыл бұрын
Most welcome
@praveenkumar-of6zu3 жыл бұрын
Thanks a lot for starting training on latest version of Selenium. It would be more helpful & thankful if you explain each step for 4.0 version as well like set up & other all topics.
@RaghavPal3 жыл бұрын
I will plan Praveen
@shahzaibidreesahmed4827 Жыл бұрын
Great explained 💓After hard work the code is successfully run 😁 Never stop learning 🙂
@RaghavPal Жыл бұрын
Glad you liked it Shahzaib
@maheshswamysamsani96885 ай бұрын
Thank you very much sir 🙂
@RaghavPal5 ай бұрын
Most welcome Mahesh
@deepak62562 жыл бұрын
Thank you so much raghav for the wonderful session. Can you please share your playlist where we have selenium learning with the demo project? Please share so we can start journey.
@RaghavPal2 жыл бұрын
Hi Deepak, can find all playlists here - automationstepbystep.com/
@Nandhis3 жыл бұрын
Thanks Raghav.. Really helpful 👍
@RaghavPal3 жыл бұрын
Most welcome
@syedarmaghanhassan4652 Жыл бұрын
Hi Raghav, a new question today: How to verify information on a webpage. For instance, price is €100; vat is 19% (€19); shipping field shows €4,99 for shipping. and then subtotal, etc. How to verifiy information (String, or a number) on a webpage. Second Question: how to use if-then-else statements with selenium? For instance, check if the searchbar appears, or search if the text in the letter exists as expected/free of erros etc. Can you please share some info/Tips on such testcases, so tha we may be able to run such verifications. Thank you!
@RaghavPal Жыл бұрын
Syed *To verify information on a webpage with Selenium Java, you can use the following steps:* 1. *Find the element on the webpage that contains the information you want to verify.* You can do this using a variety of locators, such as ID, class name, or XPath 2. *Get the text or value of the element.* You can use the `getText()` or `getAttribute()` methods to do this 3. *Compare the text or value of the element to the expected value.* You can use the `assertEquals()` or `assertThat()` methods to do this. For example, to verify that the price on a webpage is €100, you could use the following code: ```java WebElement priceElement = driver.findElement(By.id("price")); String priceText = priceElement.getText(); assertEquals("€100", priceText); ``` To verify that the VAT on a webpage is €19, you could use the following code: ```java WebElement vatElement = driver.findElement(By.id("vat")); String vatText = vatElement.getText(); assertEquals("€19", vatText); ``` To verify that the shipping field on a webpage shows €4.99 for shipping, you could use the following code: ```java WebElement shippingElement = driver.findElement(By.id("shipping")); String shippingText = shippingElement.getText(); assertEquals("€4.99", shippingText); ``` *To use if-then-else statements with Selenium, you can use the following syntax:* ```java if (condition) { // Code to execute if the condition is true } else { // Code to execute if the condition is false } ``` For example, to check if the searchbar appears on a webpage, you could use the following code: ```java WebElement searchbarElement = driver.findElement(By.id("searchbar")); if (searchbarElement.isDisplayed()) { // The searchbar is displayed } else { // The searchbar is not displayed } ``` To check if the text in a letter exists as expected/free of errors, you could use the following code: ```java WebElement letterElement = driver.findElement(By.id("letter")); String letterText = letterElement.getText(); if (letterText.contains("expected text") && !letterText.contains("errors")) { // The text in the letter is as expected and free of errors } else { // The text in the letter is not as expected or contains errors } ``` You can use if-then-else statements to verify any information on a webpage, as long as you can find the element that contains the information and get the text or value of the element. Here are some tips for writing test cases to verify information on webpages: *Be specific.* When writing your test cases, be as specific as possible about the information you want to verify. For example, instead of verifying that the price of a product is less than €100, verify that the price is exactly €99.99. *Use positive and negative test cases.* When testing your web application, it is important to use both positive and negative test cases. Positive test cases verify that the web application works as expected, while negative test cases verify that the web application handles unexpected input correctly. *Use data-driven testing.* Data-driven testing allows you to test your web application with a variety of different data values. This can help you to find bugs that would not be found using a limited set of data values. I hope this information is helpful
@syedarmaghanhassan4652 Жыл бұрын
@@RaghavPal Wow!!!!!!!! Amazing Raghav.. you game me interesting and vast Home-Work; It is such a nice challenge. I would try each one of those scenarios in coming days. Thanks a million! God bless you! 😇👍🏽
@syedarmaghanhassan4652 Жыл бұрын
@@RaghavPal hi Raghav, I used following code an it worked: // Verify the subTotal: WebElement subTotal = driver.findElement(By.className("product-price")); //************************************* String price = subTotal.getText(); assertEquals("4.00", price); if (price != null) { System.out.println("Success"); } else { System.out.println("oops"); }; the Problem is, I have to check the condition if (price = 4.00), Now, it suggest to convert the string into a double, which also does not solve the problem. How to just smiply check, if some text = 4.00 (a decimal number, because that is how they write the prices here in Germany). I even tried to write the check-condition in a string form, like if (price = "4.00") {}.... but it also didn't work. there is an underline error which suggests, "insert != null check, and in console, it says: "Type mismatch: cannot convert from String to boolean" Any suggestions to solve this? Thanks!
@RaghavPal Жыл бұрын
To verify the information on a webpage, you can use the following steps: 1. Find the element on the webpage that contains the information you want to verify. You can use Selenium locators to do this. 2. Get the text or value of the element. You can use the `getText()` or `getAttribute()` methods to do this. 3. Compare the text or value of the element to the expected value. You can use the `assertEquals()` method to do this. Here is an example of how to verify the price on a webpage: ```java // Find the element on the webpage that contains the price. WebElement priceElement = driver.findElement(By.className("product-price")); // Get the price. String price = priceElement.getText(); // Compare the price to the expected value. assertEquals("4.00", price); ``` To verify the VAT, shipping, and subtotal, you can use the same steps. Just find the elements on the webpage that contain the information you want to verify, get the text or value of the elements, and compare them to the expected values. **How to verify a decimal number on a webpage** To verify a decimal number on a webpage, you can use the following steps: 1. Get the text or value of the element that contains the decimal number. 2. Convert the text or value to a double. You can use the `Double.parseDouble()` method to do this. 3. Compare the double value to the expected value. You can use the `assertEquals()` method to do this. Here is an example of how to verify the price on a webpage, even if it is written in a decimal format: ```java // Get the text or value of the element that contains the price. String price = driver.findElement(By.className("product-price")).getText(); // Convert the price to a double. double priceDouble = Double.parseDouble(price); // Compare the double price to the expected value. assertEquals(4.00, priceDouble, 0.0); ``` **Why is the condition `if (price = 4.00)` not working?** The condition `if (price = 4.00)` is not working because you are trying to compare a string to a double. This is not allowed in Java. To fix this, you need to convert the price to a double before you compare it to the expected value. You can use the `Double.parseDouble()` method to do this. Here is an example of a working condition: ```java // Convert the price to a double. double priceDouble = Double.parseDouble(price); // Compare the double price to the expected value. if (priceDouble == 4.00) { // ... } ``` **Why is the condition `if (price = "4.00") {}` not working?** The condition `if (price = "4.00") {}` is not working because you are trying to assign a string to a boolean variable. This is not allowed in Java. To fix this, you need to compare the price string to the expected string. You can use the `equals()` method to do this. Here is an example of a working condition: ```java // Compare the price string to the expected string. if (price.equals("4.00")) { // ... } ``` I hope this helps
@syedarmaghanhassan4652 Жыл бұрын
@@RaghavPal Thanks a lot Raghav. It worked, to some extent.. I just changed the (price = "23") to double equal sign (price =="23"). I also added the code for parsing as you suggested, but somehow it is printing the "23.0" though, with only 1 decimal point after 23. How to make it print 2 decimal points? ============ here is the code: ============ WebElement subTotal = driver.findElement(By.className("product-price")); //************************************* String price = subTotal.getText(); double priceDouble = Double.parseDouble(price); assertEquals(23.00, priceDouble,0000.0000); System.out.println(priceDouble); if (priceDouble == 23.00) {System.out.println("Success");} else {System.out.println("oops");}; ================================ on the Console, 23.0 has been printed. Why not 23.00?
@chanti.podilapu3 жыл бұрын
Thank you Raghav
@RaghavPal3 жыл бұрын
Most welcome Chanti
@poojamahajan12962 жыл бұрын
Thank you so much for this video series on selenium, it is very helpful for me. I am also looking for job in software testing in USA. Anyone has any leads on this?
@RaghavPal2 жыл бұрын
You are most welcome Pooja
@HoaiNguyen-tq8xm2 жыл бұрын
thanks Raghav. It's very helpful for me. BTW, can you show me the tool that used to capture/record the screen? Thanks so much!!!
@RaghavPal2 жыл бұрын
Hi Hoài, Sure, I will show it in some session
@bhargavibingi71612 ай бұрын
Sir can share the selenium automation syllabus for freshers
@RaghavPal2 ай бұрын
Bhargavi You can focus on the following: Introduction to Automation Testing Selenium Basics Selenium WebDriver Selenium IDE Selenium Grid Programming Languages Java Python C# Selenium WebDriver Browser Navigation Element Identification Element Interactions Waits and Sync Test Automation Frameworks TestNG JUnit PyUnit Advanced Selenium Topics Handling Alerts and Pop-ups Handling Frames and Iframes Handling Dropdowns and Select Boxes Handling JavaScript Alerts Page Object Model (POM) Data-Driven Testing Cross-Browser Testing Reporting and Logging Best Practices and Troubleshooting
@sonalmittal54603 жыл бұрын
excellent
@RaghavPal3 жыл бұрын
thanks Sonal
@ashafernandes63983 жыл бұрын
Hi Raghav!! . This session is a wonderful!! .. ☺ I could see only 2 videos in this playlist (Selenium 4 Beginner Tutorials). Please let me know how can I view the remaining videos in this playlist.
@RaghavPal3 жыл бұрын
Hi Asha, they are in processing and will be published in a few days Hopefully you will get 1 or 2 videos every week
@ashafernandes63983 жыл бұрын
Thank u so much. ♥️
@ten2soft-wg9xh Жыл бұрын
please i am a beginner and i love your materials......it is very helpful.//////please how can i get documentation for selenium that will enable me carry out my job as a tester. thank you from nigeria.
@RaghavPal Жыл бұрын
Are you looking for documentation for learning Selenium?
@ten2soft-wg9xh Жыл бұрын
yes. i am looking for documentation for learning selenium. i have checked selenium website but the full documentation is not there.....can you lease assist me in getting it.....thank you from nigeria@@RaghavPal
@RaghavPal Жыл бұрын
You can find a lot of tutorials and resources, Can check my lectures here - automationstepbystep.com/
@ten2soft-wg9xh Жыл бұрын
alright. thank you Mr Raghav@@RaghavPal
@ten2soft-wg9xh Жыл бұрын
hello....please do you have a slack community
@saimjahangir21453 жыл бұрын
Sir if any one wants to learn automation testing right now, can he/she learn by following your this course or it is needed to learn previous course
@RaghavPal3 жыл бұрын
Yes Saim, you can check all here - automationstepbystep.com/
@saimjahangir21453 жыл бұрын
@@RaghavPal in this current course u will repeat all concepts or only the updates in latest version of selenium
@RaghavPal3 жыл бұрын
Hi Saim, I will focus more on Selenium 4 new features, but I have to go with all the setup and steps so that even a new beginner can follow
@saimjahangir21453 жыл бұрын
Thanks sir will follow your this course
@jilthybarquerovindas44472 жыл бұрын
good explanation, it's a shame that you don't use page factory, POM model is the most used standard
@RaghavPal2 жыл бұрын
Hi Jilthy, PageFactory is a class in Selenium API that facilitates POM structure
@jilthybarquerovindas44472 жыл бұрын
@@RaghavPal I agree with you
@prasaddeshpande2333 жыл бұрын
Hi sir, waiting for third part
@RaghavPal3 жыл бұрын
I will add soon Prasad
@debanjanghosh40943 жыл бұрын
Thanks for the session Raghav. I am facing issue with Relative Locators - toLeftOf and toRightOf. It returns "NoSuchElementFound" exception. Whereas, the same element works fine with other relative locators. Not finding a solution after debug and how can we fix such kind of issue?
@RaghavPal3 жыл бұрын
Hi Debanjan, may be the tags or locators used, I will too check on this
@karanmalhotra116410 күн бұрын
how to add two numbers on website & pass total to the website using selenium?
@RaghavPal9 күн бұрын
Karan here’s a concise example of how to add two numbers on a website and pass the total back using Selenium in Java: import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; public class AddNumbers { public static void main(String[] args) { WebDriver driver = new ChromeDriver(); driver.get("example.com"); // Replace with your URL // Input numbers driver.findElement(By.id("num1")).sendKeys("5"); driver.findElement(By.id("num2")).sendKeys("10"); // Calculate total and input it back to the site int total = 5 + 10; driver.findElement(By.id("total")).sendKeys(String.valueOf(total)); driver.quit(); } } Explanation: Open the Website: Replace "example.com" with your website URL. Enter Numbers: Locate elements by ID and send number inputs. Calculate and Input Total: Compute the sum and send it to the total field. Close the Browser: Clean up by closing the driver. Update ID selectors based on your website’s HTML structure. -
@mxledesma2 жыл бұрын
Hi RaqHav. i have a question. when i try on my eclipse on sendKeys i get. The method sendKeys(string) is undefined for the type List . I am not sure how to correct this. i have like yours J2SE-1.5. I also downloaded the correct webdriver for Chrome. which is 97.0.4692.71 saved in my eclipse folder.
@RaghavPal2 жыл бұрын
Hi Michael, this should help stackoverflow.com/questions/43928270/the-method-sendkeysstring-is-undefined-for-the-type-listwebelement
@zuchalaribastian60372 жыл бұрын
Hi Raghav, I have a question, if there is no ID, Name and other elements in Element, there is an element class like this class="oxd-button oxd-button--medium oxd-button--main orangehrm-login-button", what should I do?
@RaghavPal2 жыл бұрын
Hi Zuchal, you can create relative xpath and you can use several tools to do that like Chrome extenstions: Selenium IDE Katalon Recorder Chrome Dev Tools - kzbin.info/www/bejne/l6q5moWXmax6gLM
@zuchalaribastian60372 жыл бұрын
@@RaghavPal Thanks you Raghav, i want try it
@pavankumarpullela1892 жыл бұрын
Hi, please let me know your eclipse version and java version, I am using java 1.8.0_34 version and java version as 2022-06 version, i am not able run the code for selenium. even i am using updated versions of chrome browser and chrome driver too. please help me for the concern.
@RaghavPal2 жыл бұрын
do not remember the exact version Pavan, but what is the issue you are facing
@madhumalli7592 жыл бұрын
How can we write this Relative locator in pagefactory.Could you please help me.Is it possible
@RaghavPal2 жыл бұрын
Hi Madhu, this can help stackoverflow.com/questions/58636361/how-can-we-use-relativelocator-not-relative-xpath-in-page-factory-findby www.softwaretestinghelp.com/page-object-model-pom-with-pagefactory/
@ammuannie70332 жыл бұрын
at 19.13 the tagname name is added as input where are we getting that?by using id it was not working.
@RaghavPal2 жыл бұрын
Hi Ammu, here we are giving the exact locator for login button and trying to find a element just above login button that has tagname input
@syedarmaghanhassan4652 Жыл бұрын
18:50 hi Raghav, a strange thing is happening. 🧐 In Code, I selected a logout button, to be found first. WebElement logout = driver.findElement(By.className("ico-logout")); Then used is in a relative locator. Then I am trying to get a click on the logout button, but it just throws an error: WebElement account = driver.findElement(RelativeLocator.with(By.tagName("a")).toLeftOf(logout)); account.click(); // Till here, it is working fine. Now I want a click on the logout button, so, logout.click(); // this is not working. However, if I try to refind the element, with same code, and define a different variable, say logout2, then logout2.click(); works!! But this is really strange. Why can I not use one defined variable to get a click again and again if I wanted to?
@RaghavPal Жыл бұрын
will need to check the dom
@syedarmaghanhassan4652 Жыл бұрын
@@RaghavPalhi Raghav, sorry I didn't understand what you meant. do I need to check the DOM, or would you like to check it?
@RaghavPal Жыл бұрын
The reason you are getting an error when you try to click the logout button twice is because the element may have gone stale. Stale element errors occur when the element that you are trying to interact with has been changed or removed from the DOM since you found it. There are a few things that can cause elements to go stale: * The page may have been refreshed. * The element may have been hidden or removed from the page. * The element may have been changed in a way that makes it unrecognizable to Selenium. To avoid stale element errors, you should always try to find the element that you want to interact with again before you interact with it. This is especially important if you are performing a series of actions on the same element. In your case, you can fix the error by refinding the logout button before you click it again: ```java WebElement logout = driver.findElement(By.className("ico-logout")); account.click(); logout = driver.findElement(By.className("ico-logout")); logout.click(); ``` You could also use a different method, such as `Actions` to click the logout button: ```java WebElement logout = driver.findElement(By.className("ico-logout")); Actions actions = new Actions(driver); actions.moveToElement(logout).click().build().perform(); ``` This method is less likely to cause stale element errors, because it clicks the element directly, without having to find it again. Why did `logout2.click()` work? When you created the `logout2` variable, you were essentially creating a new reference to the logout button. This means that the `logout2` variable was not affected by the stale element error. However, it is still better to refind the element before you interact with it, even if you are using a different variable. This will help to ensure that you are interacting with the correct element, and that you are not getting any stale element errors.
@syedarmaghanhassan4652 Жыл бұрын
@@RaghavPal hi Raghav, thanks a lot for taking the time out to answer the question. Unfortunately, the Actions method also didn't work. The only thing which works is re-defining the variable again. I even tried using navigating back; even that didn't work. I don't know why, because the DOM is unchanged; only 1 element with such class name in the whole DOM. It should identify it. I especially did a brief some screen-recording for this problem, which you can have a loot at here: kzbin.info/www/bejne/eGXdqZJ-eNOso7c
@RaghavPal Жыл бұрын
will check, for now can continue with what is working
@yashgupta-qn6qg2 жыл бұрын
in my inspect element option name of element is nor showing
@RaghavPal2 жыл бұрын
can use other locators, that are available
@juanpablobarrientosarana33712 жыл бұрын
Hi Raghav, first I would like to thank you for the excellent video and helpful content. Also, I have a question for you related to Relative Locators: 1. I have a POM page defined where I am looking for all of my elements. 2. I am trying to find an element in my script referencing one WebElement defined in my POM page, but selenium is throwing me that it is not able to find the element. Code example: LaserAntsHomePage homePage = new LaserAntsHomePage(getDriver()); homePage.clickLoginButton(); this.getDriver().findElement(with(By.tagName("input")).above(homePage.getSubmitLogInButton())).sendKeys("Test"); Exception: org.openqa.selenium.json.JsonException: java.lang.reflect.InvocationTargetException In advance thanks for your help !
@RaghavPal2 жыл бұрын
Hi Juan, it can be due to java version or browser ver. this can help 1. stackoverflow.com/questions/42658344/invocationtargetexception-thrown-with-java-selenium-webdriver-action-class 2. www.edureka.co/community/7134/what-causes-java-lang-reflect-invocationtargetexception