• Jobs
  • About Us
  • professionals
    • Home
    • Jobs
    • Courses and challenges
  • business
    • Home
    • Post vacancy
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

418
Views
Java Selenium: how to print out error and catch exception from executing javascript?

The element is visible and clickable, but clicking the element is not working. Trying to catch exception and show the error message.

    try {
        element.click();
    } catch (WebDriverException e) {
        // how to print out error? also tried: System.out.println(...)
        e.printStackTrace();
       
        // how to catch exception/error from javascript?
       ((JavascriptExecutor)driver).executeScript(
             "arguments[0].click()", element);
    }

Questions:

  1. how to print out exception? Could not find the stacktrace in console(windows) or test report html.

  2. how to catch exception/error from executing javascript?

almost 3 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Our process Sales
Legal
Terms and conditions Privacy policy
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recommend me some offers
I have an error