Skip to content

Commit bceee4e

Browse files
Refactor frame method to use isEmpty for list check and String check. (#12894)
Refactor frame method to use isEmpty for list check - Replace `frameElements.size() == 0` with `frameElements.isEmpty()` in the `frame` method of `RemoteWebDriver`. This change improves code readability and adheres to best practices for checking if a list is empty.
1 parent c64e41e commit bceee4e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

java/src/org/openqa/selenium/remote/RemoteWebDriver.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ protected void startSession(Capabilities capabilities) {
259259
String platformString = (String) rawCapabilities.get(PLATFORM_NAME);
260260
Platform platform;
261261
try {
262-
if (platformString == null || "".equals(platformString)) {
262+
if (platformString == null || platformString.isEmpty()) {
263263
platform = Platform.ANY;
264264
} else {
265265
platform = Platform.fromString(platformString);
@@ -1128,11 +1128,11 @@ public WebDriver frame(String frameName) {
11281128
List<WebElement> frameElements =
11291129
RemoteWebDriver.this.findElements(
11301130
By.cssSelector("frame[name='" + name + "'],iframe[name='" + name + "']"));
1131-
if (frameElements.size() == 0) {
1131+
if (frameElements.isEmpty()) {
11321132
frameElements =
11331133
RemoteWebDriver.this.findElements(By.cssSelector("frame#" + name + ",iframe#" + name));
11341134
}
1135-
if (frameElements.size() == 0) {
1135+
if (frameElements.isEmpty()) {
11361136
throw new NoSuchFrameException("No frame element found by name or id " + frameName);
11371137
}
11381138
return frame(frameElements.get(0));

0 commit comments

Comments
 (0)