Hot answers tagged

6

This is a standard programming practice intended to reduce bugs in code. As a refresher, the final modifier prevents a primitive variable or object reference variable from being reassigned. Thus, primitives are immutable, and a reference can ever point to the object it initially pointed to. (This does not affect what methods you can call, even ones that ...


3

I think this site can help you out. The bottom line is this picture: In your case, you can easily leave out the part about the Java Virtual Machine (JVM) since that is already present in Java Runtime Environment (JRE). Therefore, your requirement could read: RedactedApplicationName shall use Java Runtime Environment (JRE) 1.8.0_241 64bit.


3

You don't actually initialize the driver before you call it. Your SeleniumDriver.openPage() call happens without any of the initialization code for the driver being called. Your code: public static SeleniumDriver seleniumDriver; //initialize webdriver public static WebDriver driver; does not actually initialize the driver - it merely declares the variable. ...


3

You just get Response object from your call and do: public class Test { public static void main(String[] args) { Response response = RestAssured .get("https://mocki.io/v1/22617277-2eca-4fcf-b7e2-8c80851ef45d"); if(response.path("shop.type") == null){ System.out.println("key does not ...


2

The approach you are using works only with native check-boxes (i.e. <input type="checkbox"/>). What you have is a custom element that looks like a check-box and behaves like a check-box but which is not really a check-box from Selenium point of view. When you have custom check-boxes you need to obtain theirs states via the CSS properties ...


2

You already found the element that contains the company code, right? So, if that is a button, use the same findElement() method to click it: driver.findElement(By.tagName("tr")).click();


2

driver.findElement(By.name("pincode")).sendKeys(rs.getString(1)); Is this what you looking for


2

I feel your pain. I live your pain: I am in the same situation, except I'm the only tester in the group and it's taken me years to get any stable, working test automation running. I'm not aware of any tooling that can be used to measure coverage in this kind of situation. When you're dealing with large legacy software where unit tests and integration tests ...


2

https://www.extentreports.com/docs/versions/5/java/index.html ExtentHtmlReporter, ExtentLoggerReporter The ExtentHtmlReporter and ExtentLoggerReporter were deprecated in series 4.1.x and have been removed in version 5. The replacement is ExtentSparkReporter, which is comprehensive, ports all features along with a host of new ones. ExtentSparkReporter spark ...


2

There are several ways you can achieve what you want to do. Basically you want to write the result of your tests in a file. For this you can use spreadsheet (XLSX) or CSV or even simple text files. To write your data in a XLSX file you can use Apache POI. Here is a reference link to help with this. You can use OpenCSV library to write the data to a CSV file. ...


2

In the first case, you are coupling your tests with the page object through a convention on the strings "email_field" and "password_field" If a change is not done correctly, you would discover it only at run time. Not so good. In the second case, you are coupling through the attributes. Erroneous changes would be catch at compilation time,...


2

Example json: { "priceOne": 1034, "priceTwo": {"new":2}, "priceThree": 7282 } Checking the value of "new" Response response =RestAssured.get("https://newnnnnnnn.free.beeceptor.com"). then().extract().response(); JSONObject jsonObj = ...


2

You can blacklist the headers you don't want to see in the report: given().config(config().logConfig(logConfig().blacklistHeader("Accept"))). .. Documentation here.


2

.click() on that slider will click on the middle. If you want to click to the side, you can click using X, Y offsets. First get the width of the slider and then adjust your X coordinate accordingly. I used this trick (in C# anyway) for testing a "scrub bar" in a web video player by clicking on the second-to-last pixel of the slider and making sure ...


1

Found the solution. Need to downgrade the extent report version. downgraded to 4.0.9 and it works for me


1

Try to update your Appium build. Here is the issue discussed. Seems that you have old Appium. The latest one is 1.20.2. The problem is how Appium proxies the request from the Java client to the actual web driver. The latest version has to have this fixed.


1

This will work: webdriver.executeScript("arguments[0].scrollIntoView(true); window.scrollBy(0, -window.innerHeight / 2);", element); The method scrollIntoView can scroll the element at the top or at the bottom of the view with the default being at the top: https://developer.mozilla.org/en/docs/Web/API/Element/scrollIntoView Below are the supported ...


1

Mobile and windows screen will have different size , I checked the page and it seems the height is larger in mobile screen try using jaa.executeScript("document.body.scrollBy(0,350);", "");


1

To select the element with text as Constants.INBOUNDORDER_CUSTOMER as the element is a Angular element you need to induce WebDriverWait for the elementToBeClickable() and you can use the following Locator Strategies: List<WebElement> options = select.findElements(By.xpath("//div[@class= 'mat-autocomplete-panel ng-star-inserted mat-autocomplete-...


1

To gather the items for your list it looks like you don't need to be specific. Try something like this: List<WebElement> options = driver.findElements(By.xpath(//*[contains(@id,"mat-option-")])); That will populate your options List with all the elements that have an ID that contains mat-option-


1

You are using java jdk 8 , You should update it to jdk 11+ https://stackoverflow.com/q/9170832/6793637


1

Although the question is highly broad ("How to test"-ish) I would guess that a good first step would be to create automated checks in two aspects: 1 - (Main part) Consumer Contracts You may want to check if your application is generating messages in the format expected by your consumer application(s). In case you are not familiar, here and here you ...


1

Your java is defined as a folder and not package try defining it as package and calling java.uk.co... if you see the folder color scheme , it shows that green means the folder is test source ; https://www.jetbrains.com/help/idea/content-roots.html#adding_content_root if you scroll down you can see its not java but test folder needs to be green color. I am ...


1

WebElement Searchbox = wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//span[contains(text(),'Search')]/ancestor::button"))); Searchbox.click(); webdriver wait returns the element , so don't find it before using wait . ALso change normalize text to text() or string()


1

You have several ways to go: If your app is pure black-box Store what you already created in memory of your test. Example - parameterization that cucumber supplies. The downside is that when your tests are done and re-run they will start from scratch so you will have to reset your application database If you have any interface that your application exposes ...


1

The maximum number you can parse to integer is 2147483647 while you're trying to parse 200 times bigger number Try to use Long.parseLong() instead.


1

Your base class should contain a driver initialization. Something like public void setUp() { WebDriver driver = new ChromeDriver() // if you are using Chrome }


1

If you really, really need to do this via UI testing, a feasible way might be to test with a Gmail account. Once you've sent your mail, use the Gmail API to poll for the new e-mail, read it, send a reply, then check back in your application for the response. This entails you'll need some library to work on API-level.


1

public void loginToStrata(String email,String psw) throws InterruptedException { enterEmail(email); enterPassword(psw); clickLogin(); Thread.sleep(1000); List<WebElement> emailErrorPresence=driver.findElements(emailError); List<WebElement> pswErrorPresence=driver.findElements(pswError); if(...


1

Write a helper method TryFindElement that doesn't throw an exception but returns false if it isn't found? Here's my C# example: public bool TryFindElement(By locator) { try { driver.FindElement(locator); return true; } catch (NoSuchElementException) { return false; } catch (TargetInvocationException) { ...


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