Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Hot answers tagged

4

Yes, you can get values in form of String after that you can use them as you want. like this - String price = driver.findElement(By.xpath("your-xpth-of-selected-value")).getText(); Now this string value you can use as you need.


4

Comments explain the flow WebElement baseCard = driver.findElement(By.id("00automation")); // Finding the base of the DOM tree where the price tag will be List<WebElement> priceTags = baseCard.findElements(By.cssSelector(".card-price-tag")); // Find all price tags elements Integer sumOfPriceTags = Arrays.stream(priceTags) // For each price tag ...


3

Looking at your code, you appear to be asserting that a string and a boolean value are equal. That isn't going to work! This is what you're doing, essentially: assertEquals(true, "United States"); Either use assertTrue, or have your verifyLocationOnViewReport method return a string that you can compare to the known value.


3

You need to get the innerHTML via getAttribute("onmouseover") function and parse the String using a regular expression. There is no direct approach from Selenium.


2

From Automation point of view following things are important: Logic OOPs concept Any language hands-on From Manual testing point of view following things are important: Basic understanding of testing terminologies Development cycle & Testing cycle Bug Reporting Testing skills From Behavioral point of view following things are important: Attitude ...


2

This isn't actually related to SSL certificates , notifications is something else. If you don't intend to use them turn them off You can have the browser started with them disabled by adding --disable-notifications to the browser command line via chrome options. This can be done programmatically as follows ChromeOptions options = new ChromeOptions(...


2

The only way to get a List from the Gherkin input is to use datatables. To use this approach in your example you would have to re-implement the Then step, like this: ... Then following keywords are here | toto | tata | titi | With mapping step like this (notice there is no regular expression to match any keywords, just the step itself): @Then("^following ...


2

If you want to build so callled "fat jar" - a single executable .jar containing all dependencies and invoking TestNG main class I would recommend going for Maven Shade Plugin: Remove the following lines from your pom.xml <scope>provided</scope> Add the following Maven Shade plugin definition to create an executable jar: <plugin> <...


2

Drivers seems implementations of JavascriptExecutor. So it can be type casting. https://docs.oracle.com/javase/tutorial/java/IandI/subclasses.html . You could read more about this at the mentioned link


1

Just replace your code using this may this help you: public class CommonAssertion{ public static String verifyLocationOnViewReport(){ String countryText= null; try{ // WebElement checkCarat=Driver.getDriver().findElement(By.xpath(PageUtility.SELECT_NEXT_LEVEL)); // checkCarat.click(); WebElement verifyCountry=...


1

AssertTrue(true, "message") is always going to be successful as you're asking it to assert that true is true! You need the first argument of assertTrue to be something that will fail if the login was not successful, e.g. the presence of an element located on the page that appears after a successful login, but not after a failed one. E.g. loginBusiness....


1

As suggested in above comment by Joao, you can get the text by String price = driver.findElement(By.xpath("your-xpth-of-selected-value")).getText(); If you expect only integers in price, then you can do: Integer.valueOf(price); If you expect floats too, you can do : Float.parseFloat(price); HTH!


1

I don't know your exact requirements in your software testing services but from question it seems you want to perform Enter key action through keyboard on a javascript popup. TO accomplish this use following code: Alert alert = new Alert(); alert.sendkeys(Keys.RETURN); or alert.sendkeys(Keys.ENTER); If that doesn't work you can use Enter key code and ...


1

It is better to create the list and iterate through the each and every element in the list and find that if it is present list[] ele = new list[](driver.findElement("")); foreach(var elementpresent in ele) { if(elementpresent.isPresent) //or elementpresent.isDisplayed { return 1; } else { return 0: } } I hope this ...


Only top voted, non community-wiki answers of a minimum length are eligible