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

Get browser version in local and container #215

Closed
wants to merge 18 commits into from

Conversation

Darshan3S
Copy link
Contributor

This PR covers the implementation for getting browser version in local. Safari,Chrome and Firefox
This PR covers the implementation for getting browser version in container
-Includes methods added for the same in browserDriverManager

The browser version fetched are stored in variable as of now in setupBrowserDriver().

case "firefox":
binaryPath = getFirefoxBinaryPath();
break;
case "safari":
Copy link
Contributor

Choose a reason for hiding this comment

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

If you are adding break in chrome, firefox, why not after safari

Copy link
Contributor

Choose a reason for hiding this comment

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

to fetch the version of safari, we are executing a separate method getSafariVersion() and skipping the next steps in current method

}
}

assert containerId != null;
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the use of this assert here
and why are we passing it here

Copy link
Contributor

Choose a reason for hiding this comment

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

if the container object does not find the matching id for container name it will return null. the assertion is added for the same.

import org.openqa.selenium.remote.RemoteWebDriver;
import org.openqa.selenium.safari.SafariDriver;
import org.openqa.selenium.safari.SafariOptions;
import java.io.File;
import org.yaml.snakeyaml.Yaml;
import java.io.*;
Copy link
Contributor

@snehith07 snehith07 Jun 29, 2023

Choose a reason for hiding this comment

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

are the total imports from java.io > 4, if not you can import specific classes.
same for java.util

Copy link
Contributor Author

Choose a reason for hiding this comment

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

total imports from java.io are > 4

Map<String, Object> services = (Map<String, Object>) data.get("services");
Map<String, Object> selenium = (Map<String, Object>) services.get("chrome");
imageName = (String) selenium.get("image");
LOGGER.info("Selenium image: " + imageName);
Copy link
Contributor

Choose a reason for hiding this comment

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

String.format() can be used to maintain uniformity

default:
throw new InvalidTestDataException("Invalid browser : " + browserType);
}
ChromeOptions chromeOptions = new ChromeOptions();
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this required we have helper methods to get binary paths.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Chrome options was used to set the binary path, removed and updated as we have helper methods to get the path

@Darshan3S Darshan3S closed this Jul 12, 2023
@Darshan3S
Copy link
Contributor Author

The implementation for getting browser version is completed and merged to teswiz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants