While learning TestNG on Udemy, I come across a code that I am unable to understand. The instructor has created a class named “TestBase” where he defined @BeforeMethod/@aftermethod.Later he created another class named “LoginTest” where he wrote the actual test with @test. He extended TestBase class in loginTest to get variable initiated in TestBase class. When he ran loginTest then
Tag: selenium
selenium java load image in for xlink:href attribute
I am trying to load images in one website, but I didn’t succeed, This is the Source Code when pressing F12 However I tried many codes : – But anyone of them is working with, can you help me please, This is the code source extract of the webpage which I would like to automate by loading images in it.
how to compare two numbers with selenium and java? (One number from CSV file and another in website)
I wrote a Program to compare prices in website with a csv file with selenium and java, at the end of program i wrote assert to confirm two numbers but it has a problem: expected price is 57,15 Actual price is 57.15 Actual Price should be 57,15 and i dont know how should i write that, Can you please help
Pause code execution if progress bar is displayed
I use this code to pause code execution: Unfortunately the html code is changed this way: I tried to implement this code” But the code execution is not paused. Can you advise how to implement his properly? Answer See if this xpath works.
My code picks the value of only first item from product page
I want to get values of items like a discount, original price, discounted price, and then I retrieve the discounted price with calculation and compare with discounted price on the website I get. But the problem I face is my code only picks the values of the first item of the product page. Answer I updated your code a bit:
Selenium Web Driver Java – User and passwords Always used
I have many codes that I wrote the user and the password but I wanted one way of to declare and call in all codes. Is this exist? Answer If I understand correctly you need to loop a set of credentials. An example where usernames and passwords are stored as Map<String, String> object. You can loop all entries in one
i’m tring to automate target.com in selenium using java
1.error in line 3 i can’t access registration btn (I tried using by id ,XPath,name and selector but dont work! ) Answer Type about:profiles in the URL bar of firefox and check if the default profile exists at the location, If it doesn’t exist just create the one and provide the default or desired location. Click on Create a new
Unable to click a button (testing)
My project is automation testing on voot app using appium(android),selenium (java) I am using appium desktop inspector to locate the id/xpath of an element and copying that in eclipse. There is a “GOT IT” button on the home page without an id or xpath, how do i go about it screenshot Answer driver.findElementByName(“GOT IT”).click(); or use the position of the
How to get the node names under one parent node of XML in java
I have a situation where I need to get the node names of one XML file in java. Here I want to get all the node names under “ns0:header” sample XML file. </SOAP-ENV:Body> </SOAP-ENV:Envelope> I was trying getchildnodes() method but unable to find that. Thanks Nihar Answer As you haven’t share your code, it is nearly impossible for me to
Ashot screenshot does not correctly crop the element from screenshot
I am trying to open this url and take the screenshot of the Keep browsing button which looks like the below image using Ashot library. Here is my dependencies on pom.xml: And here is my code: But when i executes the code, the taken screenshot not correct. Here is my screenshot: Update: After reading this question, i added the shootingStartegy