Skip to content

Commit a674664

Browse files
Merge pull request #44 from testdevlab/Remote
fix locators
2 parents 8a2036f + 2530a25 commit a674664

4 files changed

Lines changed: 8 additions & 19 deletions

File tree

src/main/java/testUI/TestUIServer.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -377,8 +377,10 @@ public static void stop() {
377377
}
378378
getDrivers().get(driver - 1).quit();
379379
removeDriver(driver - 1);
380-
getAppiumServices().get(driver - 1).stop();
381-
getAppiumServices().remove(driver - 1);
380+
if (getAppiumServices() != null && getAppiumServices().size() >= driver) {
381+
getAppiumServices().get(driver - 1).stop();
382+
getAppiumServices().remove(driver - 1);
383+
}
382384
if (getDevices().size() != 0) {
383385
iOSDevices = driver - getDevices().size();
384386
adbUtils.stopEmulator(getDevices().get(driver - iOSDevices - 1));

src/main/java/testUI/UIUtils.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
import java.util.ArrayList;
1111
import java.util.List;
12-
import java.util.logging.Logger;
1312

1413
import static com.codeborne.selenide.Selenide.*;
1514
import static testUI.TestUIDriver.*;

src/main/java/testUI/Utils/By.java

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,47 +3,38 @@
33
import com.codeborne.selenide.Selectors;
44
import testUI.Configuration;
55

6+
import static testUI.TestUIDriver.getDriver;
7+
68
public class By {
79

810
public static org.openqa.selenium.By byText(String text) {
911
if (!Configuration.automationType.equals(Configuration.DESKTOP_PLATFORM))
10-
return org.openqa.selenium.By.xpath("//*[contains(@text,'" + text + "')]");
12+
if (!getDriver().isBrowser())
13+
return org.openqa.selenium.By.xpath("//*[contains(@text,'" + text + "')]");
1114
return Selectors.byText(text);
1215
}
1316

1417
public static org.openqa.selenium.By byId(String id) {
15-
if (!Configuration.automationType.equals(Configuration.DESKTOP_PLATFORM))
16-
return org.openqa.selenium.By.id(id);
1718
return Selectors.byId(id);
1819
}
1920

2021
public static org.openqa.selenium.By byXpath(String xpath) {
21-
if (!Configuration.automationType.equals(Configuration.DESKTOP_PLATFORM))
22-
return org.openqa.selenium.By.xpath(xpath);
2322
return Selectors.byXpath(xpath);
2423
}
2524

2625
public static org.openqa.selenium.By byCssSelector(String cssSelector) {
27-
if (!Configuration.automationType.equals(Configuration.DESKTOP_PLATFORM))
28-
return org.openqa.selenium.By.cssSelector(cssSelector);
2926
return Selectors.byCssSelector(cssSelector);
3027
}
3128

3229
public static org.openqa.selenium.By byName(String name) {
33-
if (!Configuration.automationType.equals(Configuration.DESKTOP_PLATFORM))
34-
return org.openqa.selenium.By.name(name);
3530
return Selectors.byName(name);
3631
}
3732

3833
public static org.openqa.selenium.By byAttribute(String attribute, String value) {
39-
if (!Configuration.automationType.equals(Configuration.DESKTOP_PLATFORM))
40-
return org.openqa.selenium.By.xpath("//*[contains(@" + attribute + ",'" + value + "']");
4134
return Selectors.byAttribute(attribute, value);
4235
}
4336

4437
public static org.openqa.selenium.By byValue(String value) {
45-
if (!Configuration.automationType.equals(Configuration.DESKTOP_PLATFORM))
46-
return org.openqa.selenium.By.xpath("//*[contains(@value,'" + value + "']");
4738
return Selectors.byValue(value);
4839
}
4940

src/main/java/testUI/Utils/GridTestUI.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package testUI.Utils;
22

3-
import org.apache.commons.lang3.StringUtils;
43
import org.apache.http.client.methods.CloseableHttpResponse;
54
import org.apache.http.client.methods.HttpPost;
65
import org.apache.http.entity.ContentType;
@@ -16,7 +15,6 @@
1615

1716
import java.io.IOException;
1817

19-
import static testUI.Configuration.browser;
2018
import static testUI.UIUtils.putAllureParameter;
2119

2220
public class GridTestUI {
@@ -277,7 +275,6 @@ private void setDesktopConfiguration(JSONObject json) {
277275
try {
278276
Configuration.remote = json.getString("proxyURL");
279277
if (getPlatform(json) != null) {
280-
System.out.println( getPlatform(json));
281278
Configuration.selenideBrowserCapabilities.setCapability(
282279
CapabilityType.PLATFORM_NAME, getPlatform(json));
283280
}

0 commit comments

Comments
 (0)