Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why do I get step name as optional.empty? #2542

Closed
skhandekar1 opened this issue Aug 30, 2021 · 5 comments
Closed

Why do I get step name as optional.empty? #2542

skhandekar1 opened this issue Aug 30, 2021 · 5 comments
Labels

Comments

@skhandekar1
Copy link

skhandekar1 commented Aug 30, 2021

I am using the following code in my test script to catch and display any step failures:


	log.info("\n\n******************************\n"
		+ "Error Infomation \n" + "Method Name - {} \n" 
		+ "Test Case Number - {} \n******************************", 
		result.getQualifiedMethodName(), result.getTitle());


       log.info("Error type : {}", result.getTestFailureErrorType());
      log.info("First Step with error message : {}", result.firstStepWithErrorMessage());
      log.info("Failing step : {}", result.getFailingStep());
      log.info("Test Failure message : {}", result.getTestFailureSummary());

It correctly displays step names and errors but occassionally I get the step name as optional.empty instead as shown below. Is there a reason why the step name is not getting displayed for certain steps?

******************************
Error Infomation 
Method Name - Test015 
Test Case Number - TP397-132 
******************************
[INFO ] 2021-08-30 10:51:46 framework.Listeners.ExecutionListener 72 testFinished - Error type : org.openqa.selenium.NoSuchElementException
[INFO ] 2021-08-30 10:51:46 framework.Listeners.ExecutionListener 73 testFinished - First Step with error message : Optional.empty
[INFO ] 2021-08-30 10:51:46 framework.Listeners.ExecutionListener 74 testFinished - Failing step : Optional.empty
[INFO ] 2021-08-30 10:51:46 framework.Listeners.ExecutionListener 75 testFinished - Test Failure message : ERROR;org.openqa.selenium.NoSuchElementException;Timed out after 2 seconds. Element not found
For documentation on this error, please visit: https://www.seleniumhq.org/exceptions/no_such_element.html
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'NALU-PF2JP03M', ip: '192.168.137.1', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_261'
Driver info: driver.version: unknown;PulseWidthControls.java
[INFO ] 2021-08-30 10:51:46 framework.Listeners.ExecutionListener 85 testFinished - 
@wakaleo
Copy link
Member

wakaleo commented Aug 30, 2021

Sometimes Selenium does not return an error message

@skhandekar1
Copy link
Author

I seem to be getting one though as NoElementException. Isn't that a Selenium failure message? The problem seems to be where the step name is not being displayed.

@wakaleo
Copy link
Member

wakaleo commented Aug 30, 2021

Why don't you put a breakpoint and see what circumstances cause this behaviour?

@wakaleo
Copy link
Member

wakaleo commented Nov 12, 2021

Possibly fixed in 3.0.5

@wakaleo
Copy link
Member

wakaleo commented Feb 13, 2022

Fixed in 3.2.0

@wakaleo wakaleo closed this as completed Feb 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants