Skip to content
This repository was archived by the owner on Feb 2, 2025. It is now read-only.

added RobotString class for working with system properties and string… #74

Merged

Conversation

YauheniPo
Copy link
Contributor

…s and created class for working with custom keywords of WebDriver

…s and created class for working with custom keywords of WebDriver
try {
CustomRobotDriverElement.s = getLibraryInstance();
} catch (javax.script.ScriptException e) {
e.printStackTrace();

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?

Copy link
Contributor Author

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?

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.

Copy link
Contributor Author

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.

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!

@YauheniPo
Copy link
Contributor Author

public CustomRobotDriverElement() throws NoSuchFieldException, IllegalAccessException {
try {
CustomRobotDriverElement.s = getLibraryInstance();
} catch (javax.script.ScriptException e) {

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.

Copy link
Contributor Author

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());

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.

Copy link
Contributor Author

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);

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?

Copy link
Contributor Author

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());
} catch (ScriptException e) {
throw new SeleniumLibraryNonFatalException("Cannot create SeleniumLibrary instance: \n"
+ ExceptionUtils.getStackTrace(e));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


@RobotKeyword("Is Contain String Ignore Case")
@ArgumentNames({"str", "searchStr"})
public boolean isContainStringIgnoreCase(String str, String searchStr) {
Copy link
Collaborator

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"

Copy link
Contributor Author

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

@Hi-Fi Hi-Fi merged commit eef989b into MarketSquare:develop Jul 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants