nightwatch icon indicating copy to clipboard operation
nightwatch copied to clipboard

Terminal commands on new element api should return actual result from Selenium.

Open garg3133 opened this issue 1 year ago • 5 comments

Terminal commands like click(), sendKeys(), etc. available on the new element API should return the result as returned by Selenium instead of returning a WebElement, as was the case with the commands available on the older element API.

Right now, these commands return a ScopedWebElement instance when used without await, which is not useful at all. And on using await with these commands, a WebElement instance of the previous element is returned, which also does not make any sense since the terminal commands are not meant to be chained.

Instead, the exact result as returned by Selenium should be reported back to the users (which is null for most of these commands).

This is also important because right now due to this, errors from Selenium are also not reported back to the users.

image

This can potentially be solved by reverting this commit, and here is a discussion related to this change.

garg3133 avatar Aug 24 '23 17:08 garg3133

@garg3133 I want to work on this issue.

yashPratp983 avatar Feb 23 '24 08:02 yashPratp983

Sure @yashPratp983, this issue could be a little tricky to get started with but you can surely give it a try.

What we want here right now is for commands to just return the error if some error has occurred, returning WebElement in case of a success if fine right now.

garg3133 avatar Feb 23 '24 11:02 garg3133

@yashPratp983 Were you able to make any progress on this?

garg3133 avatar Feb 28 '24 08:02 garg3133

can you explain on how to re-create these errors? I've started to work on it

oohsai avatar Mar 01 '24 02:03 oohsai

Hey @garg3133 I just hit a way to solve this one i.e. to put a check over the result returning from selenium, whether it consists of any errors, if yes, then return that error else return by default WebElement object. Is it OK to solve ?

Ashu463 avatar Mar 29 '24 19:03 Ashu463