I want to highlight an element where failure happened after taking screenshot - Selenium and Java

0 votes

My code to Login to a page

@Test(testName = "Capturer", description = "A Capturer user")
public static void authenticate(String user,String password) {
    try {
        browser.get(Property.get("hostdnqa1"));
        finesseType(formUserId, Property.get(user));
        finesseType(formPassCode, Property.get(password));
        CommonGcsdFunction.captureScreenshot("Login page");
        finesseFind(buttonLogin).click();
        CommonGcsdFunction.captureScreenshot("RTGS Web landing page");
    } catch (Exception e) {
        e.printStackTrace();
    }
}


I need to highlight formUserId or formPassCode. If the password is wrong i want to highlight password field on the screenshort so that we can see where the problem is. The same goes for the user ID

Below is the code i use to take screen short:

public static void captureScreenshot(String screenshotName) {
    try {
        TakesScreenshot ts = (TakesScreenshot) browser;
        File source = ts.getScreenshotAs(OutputType.FILE);
        FileUtils.copyFile(source, new File("./Screenshots/11FEBRUARY2022IT2/" + screenshotName + ".png"));
        //logger.log(Level.INFO,"Screenshot taken");
    } catch (Exception e) {
        e.printStackTrace();
    }
}//END Screenshot
Feb 16, 2022 in Selenium by Thavha

edited Mar 4 11 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP