New answers tagged

0

You can subscribe to EmbedEvent to get all embeddings. The event also has a reference to the current test case.


0

Try double clicking on the input instead of clearing. When you double click an input all the text gets selected, now when you sendkeys to it it will overwrite the text. I have used this in the past for a similar situation. Try to write a clear loop, that clears, checks the value is empty, clears again, repeat for max X milliseconds.


0

There could be two reasons for that 1.) your element is not present on the same frame ii.) the id of the element is dynamic, you can use startswith, endswith or Contains methods of xpath. if you can share the Exception, I would be more specific on what might be causing that issue


0

Ok, I fixed the problem. I imported the project from github, and it works. I don't know why there were errors before :|


1

When you use xpath that is to locate nested elements you have to start your query from .. Like String query = ".//*[contains(@resource-id, 'delivered_indicator')]"; https://selenium.dev/selenium/docs/api/java/org/openqa/selenium/support/ui/ExpectedConditions.html#presenceOfNestedElementLocatedBy-org.openqa.selenium.By-org.openqa.selenium.By-


0

This code is for scrolling to the full height of the page. It will scroll down to the end of the page: String jsCode1 = "window.scrollBy(0, document.body.scrollHeight)"; JavascriptExecutor je = (JavascriptExecutor)driver; je.executeScript(jsCode1); This is for scrolling in an upward direction. String jsCode2 = "window.scrollBy(0, -1000)"; je....


0

You can use Talend to write a job that compares a DB to a file. See this video for an example of what Talend can do. You can use the tJoin component to check for data matches.


5

Hi size() returns integer and you are comparing with string You can use the size() method of java. util. ArrayList to find the length or size of ArrayList in Java. The size() method returns an integer equal to a number of elements present in the array list. https://www.java67.com/2016/07/how-to-find-length-size-of-arraylist-in-java.html So the ...


0

Resulting test dataset size is on average 1 000 000 rows in about 20 tables which have about 10 columns each. You are dealing with two different concerns: The calculations are performed by Interactors by manipulating Entities. For checking these calculations, you can use any unit testing libraries to exercise these objects and use your test data set. ...


0

i raised a similar protractor issue on this , the issue seems like if you give a input say "one" to textbox 'A' then you clear text box 'A' and then sends input to textbox 'B' and then sends input say "two" again to textbox 'A', A will get the value onetwo If you immediately use sendKeys after using clear() , everything works fine. if you give an input ...


0

It seems that your Select element is one level above the thing you are capturing, try using xpath of the View above your ImageView


2

Finally, this solution works for me -- Instrument the Istanbul.js. Use Command - istanbul instrument test.js >> test-instumented.js Now, use the below code in @AfterClass annotation. It will execute the below method after all tests. 4. Now, we have coverage.json. Crete a HTML using coverage,json using istanbul report.


0

You can use Istanbul to instrument front-end code for code-coverage. Process looks something like this: Start application with code instrumented by coverage tool Run the Cucumber/Selenium tests against web-app instance Generate report of with coverage tool This article describes how you can use Istanbul to generate code-coverage from UI tests. This ...


1

Try something like this: WebElement outerElement = driver.findElement(By.xpath("OTER_ELEMENT_XPATH")); WebDriverWait waiter = new WebDriverWait(driver, 100); WebElement innerElement = waiter.until(ExpectedConditions.elementToBeClickable(outerElement.findElement(By.xpath("./INNER_ELEMENT_XPATH"))));


0

You can use soft asserts from TestNG. Do some soft asserts with meaningful messages and at the and check them. Soft assert will not fail your test until you are explicitly call the assertAll() Create a SoftAssert object that you will use and at the end just call assertAll() This is not a good practice, and you should consider other techniques if you ...


0

Turns out that JUnit 5 and JUnit 4 aren't completely incompatible with each other. So, for now, I'm using Assume from JUnit 4 (along with other stuff from JUnit 5). import org.junit.Assume; Assume.assumeTrue(HOME_PAGE.contains("ekwaqua")); It's ugly, I don't like it (and I will be very grateful for another, cleaner, solution), but it's working.


0

In modern applications to gain performance not all the content is loaded at once. Option I would suggest is. Can you scroll to the bottom of the page in the start and then try to find the elements? That way you can be sure that all the elements were loaded.


0

package newproject; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; org.openqa.selenium.chrome.ChromeDriver; public class PG1 { public static void main(String[] args) { System.setProperty("webdriver.firefox.marionette","/usr/local/bin/geckodriver"); WebDriver driver = new FirefoxDriver(); ...


0

There are few ways to do it, but all of them are working as global variables in your test scripts. I agree also that there is no need to divide both tests you've mentioned into two classes. Altough if you must for some reason, then I would suggest to use Niels solution with GlobalDataStore or get familiar with TestContext which needs Cucumber in your tests (...


0

I am using data provider in each class and iterating the TestNg process. I can't upfront store the URL's because they are dynamic. There is a flag set in db for which scripts needs to be run, SO, I am retrieving the data of all the URL's having the flag set along with credentials and putting them in the result set, I am sending it one after the other to ...


2

When querying Android apps with Xpath there is no id attribute. There is a resource-id attribute instead. Appium is doing work behind the scenes to still provide By.id as a locator despite this. By.xpath("//*[contains(@resource-id, 'read_indicator')]"); If you don't use contains here, you'll need to put in the full resource-id, which is very long. Your ...


0

We faced this issue in our product too, with the added complication that we're using Dojo and as such have Javascript code that executes after the readystate complete change. Because of this, we have a small piece of Javascript code that we call after the onload Javascript has finished: /** * Sets the focus on a field */ setFocus : ...


0

WebElement extends TakesScreenshot, which means you can use getScreenshotAs on the WebElement directly. You can public void takeElementScreenshot(WebElement element) { driver.executeScript("arguments[0].scrollIntoView();", element); File screenshot = ele.getScreenshotAs(OutputType.FILE); //... } We can check if the element is in viewport ...


1

You can simply filter out the invalid options from the list: List<WebElement> items = driver.findElements(options); List<WebElement> validItems = items.stream() .filter( item -> !( item.getText().equals("Please Select") ...


0

Despite there is couple of arguable things in your code (like for (int i = 0; i < 1; i++) loop which will be executed a single time) I would suggest to solve your issue before you are entering the method. Your By should incorporate the locator that would not include option with empty value (or take all options except first one). Hence in your method's ...


Top 50 recent answers are included