Open dipakkumar1225 opened 1 year ago
Please provide full logs
Please provide full logs
Please find the attached log
https://gist.github.com/dipakkumar1225/a1bda54988dd57c154b37b9b0dd3ae6a
@dipakkumar1225 what is the output of await driver.executeScript('plugin: getWaitPluginProperties', [])
await driver.executeScript('plugin: getWaitPluginProperties', []
System.out.println("getWaitPluginProperties output " + getAppiumDriver().executeScript("plugin: getWaitPluginProperties", ImmutableMap.of()));
getWaitPluginProperties output {timeout=10000, intervalBetweenAttempts=500, excludeEnabledCheck=[]}
@dipakkumar1225 I'm unable to reproduce the issue
{
"server": {
"port": 31337,
"plugin": {
"element-wait": {
"timeout": 20000,
"intervalBetweenAttempts": 200
}
}
}
}
2023-10-20T06:43:43.631Z INFO webdriver: COMMAND executeScript("plugin: getWaitPluginProperties", <object>)
2023-10-20T06:43:43.632Z INFO webdriver: [POST] http://127.0.0.1:31337/wd/hub/session/a318510c-eb3e-47fe-a999-3477690df339/execute/sync
2023-10-20T06:43:43.632Z INFO webdriver: DATA { script: 'plugin: getWaitPluginProperties', args: [] }
2023-10-20T06:43:43.638Z INFO webdriver: RESULT {
timeout: 20000,
intervalBetweenAttempts: 200,
excludeEnabledCheck: []
}
@saikrishna321
On my end, I am still encountering the issue. I've attached a sample source link for reference:
https://github.com/dipakkumar1225/Appium2.0Plugin.git.
Could you please review and identify any mistakes I might be making? In the meantime, I'd like to share my observation: When running from the CLI, I use the --node option as:
_appium --base-path="/wd/hub/" --allow-insecure="adbshell" --relaxed-security --session-override --use-drivers="UiAutomator2" --use-plugins="images, element-wait, appium-dashboard" --config "%cd%\config\serverconfig.json"
However, in code, GeneralServerFlag.CONFIGURATION_FILE which corresponds to the --nodeconfig option.
@saikrishna321
On my end, I am still encountering the issue. I've attached a sample source link for reference:
https://github.com/dipakkumar1225/Appium2.0Plugin.git.
Could you please review and identify any mistakes I might be making? In the meantime, I'd like to share my observation: When running from the CLI, I use the --node option as:
_appium --base-path="/wd/hub/" --allow-insecure="adbshell" --relaxed-security --session-override --use-drivers="UiAutomator2" --use-plugins="images, element-wait, appium-dashboard" --config "%cd%\config\serverconfig.json"
However, in code, GeneralServerFlag.CONFIGURATION_FILE which corresponds to the --nodeconfig option.
@saikrishna321 , any update on this
appium --base-path="/wd/hub/" --allow-insecure="adb_shell" --relaxed-security --session-override --use-drivers="UiAutomator2" --use-plugins="images, element-wait, appium-dashboard" --config "%cd%\config\serverconfig.json"
However, in code, GeneralServerFlag.CONFIGURATION_FILE which corresponds to the --nodeconfig option.
@dipakkumar1225 Everything works fine with your given example.
getWaitPluginProperties output {timeout=15000, intervalBetweenAttempts=157, excludeEnabledCheck=[]}
[HTTP] --> GET /wd/hub/session/d26e1882-43e1-4ea1-843a-625377e801dd/context
[HTTP] {}
[AppiumDriver@87e5] Plugins which can handle cmd 'getCurrentContext': element-wait
[AppiumDriver@87e5] Plugin element-wait is now handling cmd 'getCurrentContext'
[AppiumDriver@87e5] Executing default handling behavior for command 'getCurrentContext'
[HTTP] <-- GET /wd/hub/session/d26e1882-43e1-4ea1-843a-625377e801dd/context 200 3 ms - 22
[HTTP]
[HTTP] --> POST /wd/hub/session/d26e1882-43e1-4ea1-843a-625377e801dd/element
[HTTP] {"using":"accessibility id","value":"open menu1"}
[AppiumDriver@87e5] Plugins which can handle cmd 'findElement': element-wait
[AppiumDriver@87e5] Plugin element-wait is now handling cmd 'findElement'
- Waiting to find element with accessibility id strategy for open menu1 selector
✖ Waiting to find element with accessibility id strategy for open menu1 selector
[AppiumDriver@87e5] Command 'findElement' was *not* handled by the following behaviours or plugins, even though they were registered to handle it: ["default"]. The command *was* handled by these: ["element-wait"].
[HTTP] <-- POST /wd/hub/session/d26e1882-43e1-4ea1-843a-625377e801dd/element 404 15010 ms - 424
You need to load the config like this
.withArgument(() -> "--config", new File("config" + File.separator + "serverconfig.json").toString())
Thank You @saikrishna321,
After loading the config file as you suggested, it began to function correctly.
06:59:28.767 [main] INFO c.a.core.manager.DriverManager - DriverManager Driver AndroidDriver: on ANDROID (4a6f73cc-3c77-46e2-a346-6d6720b29b87)
06:59:28.981 [main] INFO c.a.c.stepDefinitions.SampleDefs - Executing Splash
getWaitPluginProperties output {timeout=30000, intervalBetweenAttempts=150, excludeEnabledCheck=[click]}
However, I have a concern. If I need to override the timeout for a specific element that takes longer than the timeout defined in serverconfig.json, would the following approach be appropriate? If not, could you please provide guidance?
public void clickOnSkip() {
setExplicitWaitTimeout(50000);
webElementBtnSkip.click();
setExplicitWaitTimeoutToDefault();
}
protected void setExplicitWaitTimeout(int timeout) {
getAppiumDriver().executeScript("plugin: setWaitPluginProperties", ImmutableMap.of(
"timeout", timeout,
"intervalBetweenAttempts", 150,
"excludeEnabledCheck", List.of("click")
));
}
protected void setExplicitWaitTimeoutToDefault() {
getAppiumDriver().executeScript("plugin: setWaitPluginProperties", ImmutableMap.of(
"timeout", 30000,
"intervalBetweenAttempts", 150,
"excludeEnabledCheck", List.of("click")
));
}
@dipakkumar1225 Yes this would work.
The default element-wait retry do not override when I am trying to update from code:
{ address: '0.0.0.0', allowCors: false, basePath: '', callbackPort: 4723, debugLogSpacing: false, keepAliveTimeout: 600, localTimezone: false, loglevel: 'debug', logNoColors: false, logTimestamp: false, longStacktrace: false, noPermsCheck: false, port: 4723, relaxedSecurityEnabled: false, sessionOverride: false, strictCaps: false }
(no configuration file loaded)
via CLI or function call:
{ address: '127.0.0.1', allowInsecure: [ 'adb_shell' ], basePath: '/wd/hub/', loglevel: 'info:debug', relaxedSecurityEnabled: true, sessionOverride: true, useDrivers: [ 'UiAutomator2' ], usePlugins: [ 'element-wait', 'gestures', 'appium-dashboard' ] }
final configuration:
{ address: '127.0.0.1', allowInsecure: [ 'adb_shell' ], basePath: '/wd/hub/', logFile: 'D:\Automation-Framework\Generic\Logs\1', loglevel: 'info:debug', nodeconfig: { server: { plugin: [Object] } }, port: 4723, relaxedSecurityEnabled: true, sessionOverride: true, useDrivers: [ 'UiAutomator2' ], usePlugins: [ 'element-wait', 'gestures', 'appium-dashboard' ], showConfig: true, allowCors: false, callbackPort: 4723, debugLogSpacing: false, keepAliveTimeout: 600, localTimezone: false, logNoColors: false, logTimestamp: false, longStacktrace: false, noPermsCheck: false, strictCaps: false }