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

Using Java's printing for logging #95

Merged
merged 3 commits into from
Nov 12, 2019
Merged

Using Java's printing for logging #95

merged 3 commits into from
Nov 12, 2019

Conversation

Hi-Fi
Copy link
Collaborator

@Hi-Fi Hi-Fi commented Nov 11, 2019

Fixes #92

Juho Saarinen and others added 2 commits November 11, 2019 08:47
Fixes #52

Added input field types from Python version

Some refactoring
@Hi-Fi
Copy link
Collaborator Author

Hi-Fi commented Nov 11, 2019

Some tests seem to be broken (brobably because of changes done. Try to check those and release probably tomorrow.

@@ -319,7 +319,7 @@ public String getRemoteCapabilities() {
// Null returned from jbrowserdriver
if (getCurrentWebDriver() instanceof RemoteWebDriver
&& ((RemoteWebDriver) getCurrentWebDriver()).getCapabilities() != null) {
System.out.println(getCurrentWebDriver());
logging.info(getCurrentWebDriver().toString());
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you add more information about this log:
logging.info(String.format("Sitting capabilities for current browser - %s", getCurrentWebDriver().toString()));

@@ -50,6 +50,7 @@ public static WebElement findByHeader(WebDriver webDriver, String tableLocator,

public static WebElement findByFooter(WebDriver webDriver, String tableLocator, String content) {
List<String> locators = parseTableLocator(tableLocator, "footer");
System.out.println(Arrays.toString(locators.toArray()));
Copy link
Contributor

Choose a reason for hiding this comment

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

System.out.println(String.format("Find by footer locators: %s", locators));

Choose a reason for hiding this comment

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

Does this always output the message to a console? As a library user I don't want to see debug messages unless I'm in a debug mode.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree with you but I think if don’t remove the output, it’s better to make it readable for any users))

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This was just for debugging, used System.out.println to easily spot the ones needed to be removed.

Copy link
Contributor

Choose a reason for hiding this comment

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

ok. I think it can be removed from PR)

if (locator.charAt(locatorParts[0].length()) == "=".charAt(0)) {
System.out.println("*WARN* '=' is deprecated as locator strategy separator. ':' should be used instead" );
}
if (locator.charAt(locatorParts[0].length()) == "=".charAt(0)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

if (locator.charAt(locatorParts[0].length()) == '=') {

,(xpathConstraints.size() > 0 ? " and " : ""), Python.join(" or ", xpathSearchers));
String xpath = String.format("//%s[%s%s(%s)]",
xpathTag,
(xpathConstraints.size() > 0 ? "("+StringUtils.join(xpathConstraints, " or ")+")" : ""),
Copy link
Contributor

Choose a reason for hiding this comment

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

missed spaces

Copy link
Contributor

Choose a reason for hiding this comment

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

You can use String.format

@Hi-Fi
Copy link
Collaborator Author

Hi-Fi commented Nov 12, 2019

Could we use https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/StringUtils.html#join-T...- here in order to avoid converting an array to List?

That's already done with commit b053abc. It just seemed to use a bit more memory in Maven build, but at least code is simpler.

Added commong-lang3 explicitly as dependency

Refactoring of array handling

Using StringUtils instead of custom Python join
@Hi-Fi Hi-Fi merged commit 7164c25 into develop Nov 12, 2019
@Hi-Fi Hi-Fi deleted the logging_utf8 branch November 12, 2019 15:11
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.

Input Text shows Russian characters as question marks in a report
3 participants