-
Notifications
You must be signed in to change notification settings - Fork 16
added RobotString class for working with system properties and string… #74
added RobotString class for working with system properties and string… #74
Conversation
…s and created class for working with custom keywords of WebDriver
try { | ||
CustomRobotDriverElement.s = getLibraryInstance(); | ||
} catch (javax.script.ScriptException e) { | ||
e.printStackTrace(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like we need to do return here at least.
Also, could we log the exception with some logger? Because in the case with stdout we won't be able to turn the logging off.
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are talking about some logging for the exception?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's related to this particular line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added SeleniumLibraryNonFatalException to catch block in the CustomRobotDriverElement constr.
What do you think about it? I cannot use the default logging (@Autowired protected Logging logging;) of the framework in the class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about it?
It's much better to me. Thank you!
I cannot use the default logging (@Autowired protected Logging logging;) of the framework in the class.
Yes, I understand it now. Thank you!
…botDriverElement constr.
Example of how I can use CustomRobotDriverElement in my test-framework: |
public CustomRobotDriverElement() throws NoSuchFieldException, IllegalAccessException { | ||
try { | ||
CustomRobotDriverElement.s = getLibraryInstance(); | ||
} catch (javax.script.ScriptException e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As we have an import for javax.script.ScriptException, we could use a short name here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
try { | ||
CustomRobotDriverElement.s = getLibraryInstance(); | ||
} catch (javax.script.ScriptException e) { | ||
throw new SeleniumLibraryNonFatalException("Cannot create SeleniumLibrary instance: " + e.getMessage()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible that ScriptException contain something useful in its stack trace? If yes, then we could retain a whole exception, not just its message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
throw new SeleniumLibraryNonFatalException("Cannot create SeleniumLibrary instance: " + e.getMessage()); | ||
} | ||
Field bmField = SeleniumLibrary.class.getDeclaredField("bm"); | ||
bmField.setAccessible(true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we change the visibility back to the previous state after getting what we need?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
…botDriverElement class
throw new SeleniumLibraryNonFatalException("Cannot create SeleniumLibrary instance: " + e.getMessage()); | ||
} catch (ScriptException e) { | ||
throw new SeleniumLibraryNonFatalException("Cannot create SeleniumLibrary instance: \n" | ||
+ ExceptionUtils.getStackTrace(e)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code can be simplified by just providing an exception as the second parameter:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
…botDriverElement class
src/main/java/com/github/markusbernhardt/seleniumlibrary/CustomRobotDriverElement.java
Outdated
Show resolved
Hide resolved
|
||
@RobotKeyword("Is Contain String Ignore Case") | ||
@ArgumentNames({"str", "searchStr"}) | ||
public boolean isContainStringIgnoreCase(String str, String searchStr) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this duplicate witn https://robotframework.org/robotframework/latest/libraries/BuiltIn.html#Should%20Contain?
Also, if it's useful to redefine, same naming should be used. E.g. "Should Contain With Case Ignored"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with you)
Deleted
…s and created class for working with custom keywords of WebDriver