|
3 | 3 | import com.codeborne.selenide.Selectors; |
4 | 4 | import testUI.Configuration; |
5 | 5 |
|
| 6 | +import static testUI.TestUIDriver.getDriver; |
| 7 | + |
6 | 8 | public class By { |
7 | 9 |
|
8 | 10 | public static org.openqa.selenium.By byText(String text) { |
9 | 11 | 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 + "')]"); |
11 | 14 | return Selectors.byText(text); |
12 | 15 | } |
13 | 16 |
|
14 | 17 | 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); |
17 | 18 | return Selectors.byId(id); |
18 | 19 | } |
19 | 20 |
|
20 | 21 | 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); |
23 | 22 | return Selectors.byXpath(xpath); |
24 | 23 | } |
25 | 24 |
|
26 | 25 | 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); |
29 | 26 | return Selectors.byCssSelector(cssSelector); |
30 | 27 | } |
31 | 28 |
|
32 | 29 | 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); |
35 | 30 | return Selectors.byName(name); |
36 | 31 | } |
37 | 32 |
|
38 | 33 | 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 + "']"); |
41 | 34 | return Selectors.byAttribute(attribute, value); |
42 | 35 | } |
43 | 36 |
|
44 | 37 | 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 + "']"); |
47 | 38 | return Selectors.byValue(value); |
48 | 39 | } |
49 | 40 |
|
|
0 commit comments