AppiumTestDistribution / appium-wait-plugin

Plugin to automatically manage all element waits and enables to write wait-free appium tests.
MIT License
60 stars 10 forks source link

findElement() not working with IOSDriver if I start appium server with element-wait plugin #76

Closed Renjith-H closed 1 year ago

Renjith-H commented 1 year ago

Step 1) Installed element-wait version : 1.4.0 Step 2) Started server using command : appium --use-plugins=element-wait Step 3) Trying to run the below code : _@test void iOSTapTest() throws MalformedURLException, InterruptedException { XCUITestOptions options = new XCUITestOptions(); options.setApp(System.getProperty("user.dir")+"/apps/iOS-Simulator-MyRNDemoApp.1.3.0-162.zip"); options.setDeviceName("iPhone 11 Pro"); options.setPlatformName("iOS"); options.setAutomationName("XCuiTest"); IOSDriver iosDriver = new IOSDriver(new URL("http://127.0.0.1:4723"),options); Thread.sleep(10000); WebElement ele = iosDriver.findElement(By.xpath("//XCUIElementTypeButton[@name='tab bar option menu']")); ele.click();

  }_

Step 4) Appium Server logs:

[debug] [XCUITestDriver@ec88 (59853a01)] Calling AppiumDriver.findElement() with args: ["xpath","//XCUIElementTypeButton[@name='tab bar option menu']","59853a01-c637-45bd-bfaf-1bfde65462b8"] [AppiumDriver@e07f] Plugins which can handle cmd 'findElement': element-wait [AppiumDriver@e07f] Plugin element-wait is now handling cmd 'findElement' [wait-plugin] Timeout properties not set for session 59853a01-c637-45bd-bfaf-1bfde65462b8, trying to set one [wait-plugin] Timeout properties set for session 59853a01-c637-45bd-bfaf-1bfde65462b8 is {"timeout":10000,"intervalBetweenAttempts":500,"overrideTimeout":false} ms [AppiumDriver@e07f] 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"]. [debug] [XCUITestDriver@ec88 (59853a01)] Encountered internal error running command: TypeError: Cannot read properties of undefined (reading 'jwproxy') [debug] [XCUITestDriver@ec88 (59853a01)] at sessionInfo (/Users/q/.appium/node_modules/appium-wait-plugin/lib/element.js:140:52) [debug] [XCUITestDriver@ec88 (59853a01)] at /Users/q/.appium/node_modules/appium-wait-plugin/lib/element.js:33:36 [debug] [XCUITestDriver@ec88 (59853a01)] at Generator.next () [debug] [XCUITestDriver@ec88 (59853a01)] at /Users/q/.appium/node_modules/appium-wait-plugin/lib/element.js:8:71 [debug] [XCUITestDriver@ec88 (59853a01)] at new Promise () [debug] [XCUITestDriver@ec88 (59853a01)] at awaiter (/Users/q/.appium/node_modules/appium-wait-plugin/lib/element.js:4:12) [debug] [XCUITestDriver@ec88 (59853a01)] at find (/Users/q/.appium/node_modules/appium-wait-plugin/lib/element.js:22:12) [debug] [XCUITestDriver@ec88 (59853a01)] at WaitCommandPlugin. (/Users/q/.appium/node_modules/appium-wait-plugin/lib/plugin.js:41:38) [debug] [XCUITestDriver@ec88 (59853a01)] at Generator.next () [debug] [XCUITestDriver@ec88 (59853a01)] at /Users/q/.appium/node_modules/appium-wait-plugin/lib/plugin.js:8:71 [debug] [XCUITestDriver@ec88 (59853a01)] at new Promise () [debug] [XCUITestDriver@ec88 (59853a01)] at awaiter (/Users/q/.appium/node_modules/appium-wait-plugin/lib/plugin.js:4:12) [debug] [XCUITestDriver@ec88 (59853a01)] at WaitCommandPlugin.findElement (/Users/q/.appium/node_modules/appium-wait-plugin/lib/plugin.js:39:16) [debug] [XCUITestDriver@ec88 (59853a01)] at /opt/homebrew/lib/node_modules/appium/lib/appium.js:734:35 [debug] [XCUITestDriver@ec88 (59853a01)] at AppiumDriver.executeWrappedCommand (/opt/homebrew/lib/node_modules/appium/lib/appium.js:774:22) [debug] [XCUITestDriver@ec88 (59853a01)] at AppiumDriver.executeCommand (/opt/homebrew/lib/node_modules/appium/lib/appium.js:696:28) [debug] [XCUITestDriver@ec88 (59853a01)] at asyncHandler (/opt/homebrew/lib/node_modules/appium/node_modules/@appium/base-driver/lib/protocol/protocol.js:387:32) [debug] [XCUITestDriver@ec88 (59853a01)] at /opt/homebrew/lib/node_modules/appium/node_modules/@appium/base-driver/lib/protocol/protocol.js:512:15 [debug] [XCUITestDriver@ec88 (59853a01)] at Layer.handle [as handle_request] (/opt/homebrew/lib/node_modules/appium/node_modules/express/lib/router/layer.js:95:5) [debug] [XCUITestDriver@ec88 (59853a01)] at next (/opt/homebrew/lib/node_modules/appium/node_modules/express/lib/router/route.js:144:13) [debug] [XCUITestDriver@ec88 (59853a01)] at Route.dispatch (/opt/homebrew/lib/node_modules/appium/node_modules/express/lib/router/route.js:114:3) [debug] [XCUITestDriver@ec88 (59853a01)] at Layer.handle [as handle_request] (/opt/homebrew/lib/node_modules/appium/node_modules/express/lib/router/layer.js:95:5) [debug] [XCUITestDriver@ec88 (59853a01)] at /opt/homebrew/lib/node_modules/appium/node_modules/express/lib/router/index.js:284:15 [debug] [XCUITestDriver@ec88 (59853a01)] at param (/opt/homebrew/lib/node_modules/appium/node_modules/express/lib/router/index.js:365:14) [debug] [XCUITestDriver@ec88 (59853a01)] at param (/opt/homebrew/lib/node_modules/appium/node_modules/express/lib/router/index.js:376:14) [debug] [XCUITestDriver@ec88 (59853a01)] at Function.process_params (/opt/homebrew/lib/node_modules/appium/node_modules/express/lib/router/index.js:421:3) [debug] [XCUITestDriver@ec88 (59853a01)] at next (/opt/homebrew/lib/node_modules/appium/node_modules/express/lib/router/index.js:280:10) [debug] [XCUITestDriver@ec88 (59853a01)] at logger (/opt/homebrew/lib/node_modules/appium/node_modules/morgan/index.js:144:5) [HTTP] <-- POST /session/59853a01-c637-45bd-bfaf-1bfde65462b8/element 500 37 ms - 691 [HTTP] [XCUITestDriver@ec88 (59853a01)] Shutting down because we waited 60 seconds for a command [AppiumDriver@e07f] Ending session, cause was 'New Command Timeout of 60 seconds expired. Try customizing the timeout using the 'newCommandTimeout' desired capability' [debug] [AppiumDriver@e07f] Plugin element-wait does not define an unexpected shutdown handler [AppiumDriver@e07f] Removing session '59853a01-c637-45bd-bfaf-1bfde65462b8' from our master session list [DevCon Factory] Releasing connections for 4DA0152E-6B3A-4BB3-8DE1-B78690B47115 device on any port number [DevCon Factory] Found cached connections to release: ["4DA0152E-6B3A-4BB3-8DE1-B78690B47115:8100"] [debug] [DevCon Factory] Cached connections count: 0 [debug] [XCUITestDriver@ec88 (59853a01)] Not clearing log files. Use clearSystemFiles capability to turn on. [debug] [IOSSimulatorLog] Stopping iOS log capture

Renjith-H commented 1 year ago

Hi Team, any updates?

saikrishna321 commented 1 year ago

@Renjith-H Please try version 1.5.0