Skip to content

Commit 0996674

Browse files
committed
Updated examples
1 parent f3f2804 commit 0996674

8 files changed

Lines changed: 66 additions & 9 deletions

File tree

Docs/source/_static/examples~/appium/csharp-appium.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
public static void SetConnectionData(AppiumDriver appiumDriver, string? host = null, string? port = null, string? appName = null, int timeout = 60)
1+
public static void SetConnectionData(AppiumDriver appiumDriver, string? host = null, string? port = null, string? appName = null, bool dontShowThisAgain = false, int timeout = 60)
22
{
33
if (appiumDriver == null)
44
{
@@ -34,6 +34,16 @@ public static void SetConnectionData(AppiumDriver appiumDriver, string? host = n
3434
appNameField.SendKeys(appName);
3535
}
3636

37+
// Set "Don't show this again" if specified
38+
if (dontShowThisAgain)
39+
{
40+
var dontShowAgainCheckbox = appiumDriver.FindElement(MobileBy.AccessibilityId("AltTesterDontShowAgainCheckbox"));
41+
if (!dontShowAgainCheckbox.Selected)
42+
{
43+
dontShowAgainCheckbox.Click();
44+
}
45+
}
46+
3747
// Press OK button
3848
var okButton = appiumDriver.FindElement(MobileBy.AccessibilityId("AltTesterOkButton"));
3949
okButton.Click();

Docs/source/_static/examples~/appium/java-appium.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ public static void setConnectionData(AppiumDriver appiumDriver,
22
String host,
33
String port,
44
String appName,
5+
boolean dontShowThisAgain,
56
int implicitWaitTimeoutSeconds) {
67
if (appiumDriver == null) {
78
throw new IllegalArgumentException("Appium driver cannot be null");
@@ -33,6 +34,14 @@ public static void setConnectionData(AppiumDriver appiumDriver,
3334
appNameField.sendKeys(appName);
3435
}
3536

37+
// Set "Don't show this again" if specified
38+
if (dontShowThisAgain) {
39+
WebElement dontShowAgainCheckbox = appiumDriver.findElement(AppiumBy.accessibilityId("AltTesterDontShowAgainCheckbox"));
40+
if (!dontShowAgainCheckbox.isSelected()) {
41+
dontShowAgainCheckbox.click();
42+
}
43+
}
44+
3645
// Press OK button
3746
WebElement okButton = appiumDriver.findElement(AppiumBy.accessibilityId("AltTesterOkButton"));
3847
okButton.click();

Docs/source/_static/examples~/appium/python-appium.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
def set_connection_data(cls, host=None, port=None, app_name=None, implicit_wait_timeout=60):
1+
def set_connection_data(cls, host=None, port=None, app_name=None, dont_show_this_again=False, implicit_wait_timeout=60):
22
if cls.appium_driver is None:
33
raise ValueError("Appium driver cannot be None")
44

@@ -24,6 +24,12 @@ def set_connection_data(cls, host=None, port=None, app_name=None, implicit_wait_
2424
app_name_field.clear()
2525
app_name_field.send_keys(app_name)
2626

27+
# Set "Don't show this again" if specified
28+
if dont_show_this_again:
29+
dont_show_again_checkbox = cls.appium_driver.find_element(by=AppiumBy.ACCESSIBILITY_ID, value="AltTesterDontShowAgainCheckbox")
30+
if not dont_show_again_checkbox.is_selected():
31+
dont_show_again_checkbox.click()
32+
2733
# Press OK button
2834
ok_button = cls.appium_driver.find_element(by=AppiumBy.ACCESSIBILITY_ID, value="AltTesterOkButton")
2935
ok_button.click()

Docs/source/_static/examples~/appium/robot-appium.robot

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Library AppiumLibrary
44

55
*** Keywords ***
66
Set Connection Data
7-
[Arguments] ${host}= ${port}= ${app_name}= ${implicit_wait_timeout}=60
7+
[Arguments] ${host}= ${port}= ${app_name}= ${dont_show_this_again}=False ${implicit_wait_timeout}=60
88

99
# Wait to ensure elements are found during connection setup
1010
Wait Until Page Contains Element accessibility_id=AltTesterHostInputField timeout=${implicit_wait_timeout}
@@ -21,6 +21,10 @@ Set Connection Data
2121
Run Keyword If '${app_name}' != '' Clear Text accessibility_id=AltTesterAppNameInputField
2222
Run Keyword If '${app_name}' != '' Input Text accessibility_id=AltTesterAppNameInputField ${app_name}
2323

24+
# Set "Don't show this again" if specified
25+
${checkbox_selected}= Run Keyword If '${dont_show_this_again}' == 'True' Get Element Attribute accessibility_id=AltTesterDontShowAgainCheckbox checked
26+
Run Keyword If '${dont_show_this_again}' == 'True' and '${checkbox_selected}' != 'true' Click Element accessibility_id=AltTesterDontShowAgainCheckbox
27+
2428
# Press OK button
2529
Click Element accessibility_id=AltTesterOkButton
2630

Docs/source/_static/examples~/selenium/csharp-selenium.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public void SetUp()
2323
altDriver = new AltDriver(host: altServerHost, port: int.Parse(altServerPort), appName: appName);
2424
}
2525

26-
private void SetConnectionData(string? host = null, string? port = null, string? appName = null, int implicitWaitTimeout = 60)
26+
private void SetConnectionData(string? host = null, string? port = null, string? appName = null, bool dontShowThisAgain = false, int implicitWaitTimeout = 60)
2727
{
2828
if (driver == null)
2929
{
@@ -59,6 +59,16 @@ private void SetConnectionData(string? host = null, string? port = null, string?
5959
appNameField.SendKeys(appName);
6060
}
6161

62+
// Set "Don't show this again" if specified
63+
if (dontShowThisAgain)
64+
{
65+
var dontShowAgainCheckbox = driver.FindElement(OpenQA.Selenium.By.Id("AltTesterDontShowAgainCheckbox"));
66+
if (!dontShowAgainCheckbox.Selected)
67+
{
68+
dontShowAgainCheckbox.Click();
69+
}
70+
}
71+
6272
// Press OK button
6373
var okButton = driver.FindElement(OpenQA.Selenium.By.Id("AltTesterOkButton"));
6474
okButton.Click();

Docs/source/_static/examples~/selenium/java-selenium.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ public static void setUp() {
3838
}
3939

4040
public static void setConnectionData(String host, String port, String appName) {
41-
setConnectionData(host, port, appName, 60);
41+
setConnectionData(host, port, appName, false, 60);
4242
}
43-
44-
public static void setConnectionData(String host, String port, String appName, int implicitWaitTimeout) {
43+
44+
public static void setConnectionData(String host, String port, String appName, boolean dontShowThisAgain, int implicitWaitTimeout) {
4545
if (driver == null) {
4646
throw new IllegalArgumentException("Selenium driver cannot be null");
4747
}
@@ -71,6 +71,14 @@ public static void setConnectionData(String host, String port, String appName, i
7171
appNameField.sendKeys(appName);
7272
}
7373

74+
// Set "Don't show this again" if specified
75+
if (dontShowThisAgain) {
76+
WebElement dontShowAgainCheckbox = driver.findElement(By.id("AltTesterDontShowAgainCheckbox"));
77+
if (!dontShowAgainCheckbox.isSelected()) {
78+
dontShowAgainCheckbox.click();
79+
}
80+
}
81+
7482
// Press OK button
7583
WebElement okButton = driver.findElement(By.id("AltTesterOkButton"));
7684
okButton.click();

Docs/source/_static/examples~/selenium/python-selenium.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def setUpClass(cls):
2121
cls.altdriver = AltDriver(app_name=app_name, port=int(altserver_port))
2222

2323
@classmethod
24-
def set_connection_data(cls, host=None, port=None, app_name=None, implicit_wait_timeout=60):
24+
def set_connection_data(cls, host=None, port=None, app_name=None, dont_show_this_again=False, implicit_wait_timeout=60):
2525
if cls.driver is None:
2626
raise ValueError("Selenium driver cannot be None")
2727

@@ -47,6 +47,12 @@ def set_connection_data(cls, host=None, port=None, app_name=None, implicit_wait_
4747
app_name_field.clear()
4848
app_name_field.send_keys(app_name)
4949

50+
# Set "Don't show this again" if specified
51+
if dont_show_this_again:
52+
dont_show_again_checkbox = cls.driver.find_element(by=By.ID, value="AltTesterDontShowAgainCheckbox")
53+
if not dont_show_again_checkbox.is_selected():
54+
dont_show_again_checkbox.click()
55+
5056
# Press OK button
5157
ok_button = cls.driver.find_element(by=By.ID, value="AltTesterOkButton")
5258
ok_button.click()

Docs/source/_static/examples~/selenium/robot-selenium.robot

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Suite Setup Tests
1111
Initialize Altdriver host="127.0.0.1" port=13005 app_name="my_app"
1212

1313
Set Connection Data
14-
[Arguments] ${host}=None ${port}=None ${app_name}=None ${implicit_wait_timeout}=60
14+
[Arguments] ${host}=None ${port}=None ${app_name}=None ${dont_show_this_again}=False ${implicit_wait_timeout}=60
1515

1616
# Set implicit wait
1717
Set Selenium Implicit Wait ${implicit_wait_timeout}s
@@ -28,5 +28,9 @@ Set Connection Data
2828
Run Keyword If '${app_name}' != 'None'
2929
... Input Text id:AltTesterAppNameInputField ${app_name}
3030

31+
# Set "Don't show this again" if specified
32+
${checkbox_selected}= Run Keyword If '${dont_show_this_again}' == 'True' Get Element Attribute id:AltTesterDontShowAgainCheckbox checked
33+
Run Keyword If '${dont_show_this_again}' == 'True' and '${checkbox_selected}' != 'true' Click Element id:AltTesterDontShowAgainCheckbox
34+
3135
# Press OK button
3236
Click Button id:AltTesterOkButton

0 commit comments

Comments
 (0)