7

How do users verify the data is saved? I would make the test take the same path. In your case placing an order might result into an item in the checkout shopping-basket. Find elements in the shopping basket and count them, get their text and validate that with an assert library (JUnit or TestNG). Simple example: WebDriver driver = new ChromeDriver(); // ...


6

I think in Python you can check for None or "" on Empty string Some options: self.assertEqual(element.text, None) self.assertEqual(element.text, "") self.assertEqual(len(element.text), 0) Also check this question for other options: https://stackoverflow.com/questions/9573244/how-to-check-if-the-string-is-empty


5

It depends Now for the longer answer. If you have full control over your test database, you can have your tests configured in a way that allows them to always start from the same known point. One way to do this is to restore your test database at the start of each test run. Another is to use containers. If restoring the test database isn't possible, you ...


4

You can get the selected value from dropdown using getFirstSelectedOption() and getText() methods. System.out.println("Selected country: " + drpcountry.getFirstSelectedOption().getText()); For reference: http://seleniumtwo-by-arun.blogspot.com/2013/07/144-using-getfirstselectedoption-with.html


4

Test Automation on itself should not be a field if you ask me, therefor it is mostly software developers (that value automated testing highly) who write books/articles that drive the field. Because very good software developers are also very good testers. Kent Beck: My personal favorite is Kent Beck and his book Test-Driven Development. Beck was one of ...


3

Method click() that you invoke on located element does not return anything. It is void (you probably used this "type" in some of your methods declaration like public static void main(), etc). So as that method is called the last in your right-hand side of assignment, Java assumes you're trying to assign what the method returns to what you have on left-hand ...


3

This is going to be blunt. I don't know a not-blunt way to say this. First, learn to code. Working with Selenium, no matter what your toolkit happens to be, is writing code. If you don't understand the code or the principles behind the code, you will be constantly frustrated, and worse, you will irritate your peers with what will seem to experienced coders ...


2

You should consider: Which language to pair it with How to immediately integrate with CI How to approach naming identifiers, i.e. page objects What language application developers use (for pairing) How to handle timing issues and intermittent failures well Whether to use a js approach such as Jasmine, Jest, etc. for some/all tests Whether to use Visual ...


2

Have a look at Alan Richardson who has a lot of online courses - mostly Java focussed and also useful for newbies (they are up-to-date and he provides coaching as well), books and is a general nice guy (not important in itself ;-) ) Another would be Richard Bradshaw who ticks the same boxes. Richard also provides several free online courses. Both are ...


2

I agree with Niels` suggestion of checking the database. An alternative could be refreshing the page, or navigating back and forth and asserting that you still see the value. That would imply that the data is stored. But before that I would suggest talking with your development team (if that is the case here) and see if this check for storing in the ...


2

You first have to open the menu, by clicking on the From City text, using ID. driver.find_element_by_id("fromCity").click() Then you can query the autocomplete, but fixing the locator you used (only one class is necessary): driver.find_element_by_css_selector(".react-autosuggest__input--open")


1

I think by class name only takes a single class not multiple. You could try a css selector to find elements with two classes: element = driver.find_element_by_css_selector(".react-autosuggest__input.react-autosuggest__input--open") Or just only use one of the classes instead of both.


1

Since I don't have the problem anymore, I'm going to self answer: I added some waits in the process, to make sure the page is fully loaded every time. I upgraded my driver from 3.14 to 3.15


1

I think you can just converta tuple to a string and compare them: # Python3 code to convert tuple # into string def convertTuple(tup): str = ''.join(tup) return str # Driver code tuple = ('g', 'e', 'e', 'k', 's') str = convertTuple(tuple) print(str) Source: https://www.geeksforgeeks.org/python-program-to-convert-a-tuple-to-a-string/


1

You can create a method that would validate data in one row of a table. It could accept the row number and expected values. So you would just reuse that method for all the table rows. This would make your code less complex and more readable.


1

I would advise against chaining at this level, for reasons stated at Chaining WebElement actions. The preferred approach would be to have a helper method, reducing the code duplication of clearing a field (and possibly other actions) every time you want to set text. public void SetText(IWebElement element, string text) { element.Clear(); element....


1

There is no straightforward solution for something like this, since it is a content specific problem. StaleElementReferenceException, according to Selenium docs, is thrown in one of two cases: A stale element reference exception is thrown in one of two cases, the first being more common than the second: The element has been deleted entirely. ...


1

Hi @Forumqaa Below code may help for you. Please change the logic as per you. public class Sac { public static void main(String[] args) throws IOException { Sac s = new Sac (); s.getData("TC_001"); } public ArrayList<String> getData(String testCaseName) throws IOException{ ArrayList<String> a = new ArrayList<String>(); ...


1

I suspect your problem lies with the errors: java.lang.SecurityException: You need the android.permission.INSTALL_GRANT_RUNTIME_PERMISSIONS permission to use the PackageManager.INSTALL_GRANT_RUNTIME_PERMISSIONS This is saying that the phone does not have permission to run your software. Because your code is setting the capability "noReset" to true, you ...


1

Depending on what you are testing (i.e. the actual process of using the upload control, or just the ability to upload / validate a file) you can skip the upload popup entirely. This also means you don't need autoit (which will mean you can run the tests on unattended (locked) machines. e.g. Generally any upload button will be something like the below when ...


1

You Can Check if cell is numeric or String through this code if(MytempCell.getCellType() == Cell.CELL_TYPE_NUMERIC) your code ... else if(MytempCell.getCellType() == Cell.CELL_TYPE_STRING) your code ..


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