appium / ruby_lib

:gem: Ruby library for Appium
http://rubygems.org/gems/appium_lib
216 stars 160 forks source link

undefined method `click' for false:FalseClass (NoMethodError) only on emulator #873

Closed Shahin-M2M closed 4 years ago

Shahin-M2M commented 4 years ago

The problem

I've a problem which i cant solve. I started writing my tests with a real device, and if i run the tests with a real device, the tests are running ok.

But when testing with an emulator, i'm getting error:

undefined method "click" for false:FalseClass (NoMethodError)

example command: find_element(:xpath, path).click

It seems like the elements are not found!

Environment

This is how i set the driver

$driver = Appium::Driver.new(android_caps, false) Appium.promote_appium_methods AppiumWorld

World do AppiumWorld.new end

before and after Cucumber hooks

Before do $driver.start_driver end

After do $driver.driver_quit end

KazuCocoa commented 4 years ago

Could you attach the full log?

It seems like the elements are not found!

Yes, it looks you got no element.

Shahin-M2M commented 4 years ago

Could you attach the full log?

It seems like the elements are not found!

Yes, it looks you got no element.

`log4j:ERROR setFile(null,true) call failed. java.io.FileNotFoundException: ./logs/log.txt (No such file or directory) at java.io.FileOutputStream.open0(Native Method) at java.io.FileOutputStream.open(FileOutputStream.java:270) at java.io.FileOutputStream.(FileOutputStream.java:213) at java.io.FileOutputStream.(FileOutputStream.java:133) at org.apache.log4j.FileAppender.setFile(FileAppender.java:294) at org.apache.log4j.RollingFileAppender.setFile(RollingFileAppender.java:207) at org.apache.log4j.FileAppender.activateOptions(FileAppender.java:165) at org.apache.log4j.config.PropertySetter.activate(PropertySetter.java:307) at org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:172) at org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:104) at org.apache.log4j.PropertyConfigurator.parseAppender(PropertyConfigurator.java:842) at org.apache.log4j.PropertyConfigurator.parseCategory(PropertyConfigurator.java:768) at org.apache.log4j.PropertyConfigurator.configureRootCategory(PropertyConfigurator.java:648) at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:514) at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:580) at org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionConverter.java:526) at org.apache.log4j.LogManager.(LogManager.java:127) at org.apache.log4j.Logger.getLogger(Logger.java:117) at imagestudio.ImageStudioApp.(ImageStudioApp.java:70) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.exe4j.runtime.LauncherEngine.launch(LauncherEngine.java:85) at com.install4j.runtime.launcher.MacLauncher.main(MacLauncher.java:53) Product name: AppiumStudio Appdir path: /Users/qa/appiumstudio Starting the internal [HTTP/1.1] server on port 4723 2020-01-22 10:20:29,282 [AWT-EventQueue-0] (imagestudio.ImageStudioApp) ERROR Cannot hide splash screen com.install4j.api.launcher.SplashScreen$ConnectionException: no splash screen available at com.install4j.api.launcher.SplashScreen.hide(SplashScreen.java:48) at imagestudio.ImageStudioApp.startupLow(ImageStudioApp.java:299) at imagestudio.ImageStudioApp.startup(ImageStudioApp.java:261) at org.jdesktop.application.Application$1.run(Application.java:171) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756) at java.awt.EventQueue.access$500(EventQueue.java:97) at java.awt.EventQueue$3.run(EventQueue.java:709) at java.awt.EventQueue$3.run(EventQueue.java:703) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76) at java.awt.EventQueue.dispatchEvent(EventQueue.java:726) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93) at java.awt.EventDispatchThread.run(EventDispatchThread.java:82) The connection was broken. It was probably closed by the client. Reason: Broken pipe 2020-01-22 10:25:59,640 [Restlet-262045854-findElement-sid:8eb28255-2dc0-40e3-8fb7-52adc896dc89] (backend.commands.AppiumCommand) ERROR com.experitest.image.agent.appium.backend.errors.STAppiumException: An element could not be located on the page using the given search parameters (XPATH='//[@id='loginContinueButton']') com.experitest.image.agent.appium.backend.errors.STAppiumException: An element could not be located on the page using the given search parameters (XPATH='//[@id='loginContinueButton']') at com.experitest.image.agent.appium.backend.errors.STAppiumException.newNoSuchElementException(STAppiumException.java:143) at com.experitest.image.agent.appium.backend.commands.find.GeneralFindElementCommand.findElements(GeneralFindElementCommand.java:130) at com.experitest.image.agent.appium.backend.commands.find.GeneralFindElementCommand.findElements(GeneralFindElementCommand.java:61) at com.experitest.image.agent.appium.backend.commands.find.GeneralFindElementCommand.findElement(GeneralFindElementCommand.java:33) at com.experitest.image.agent.appium.backend.commands.find.FindElementCommand.doExecute(FindElementCommand.java:9) at com.experitest.image.agent.appium.backend.commands.AppiumCommand.execute(AppiumCommand.java:173) at com.experitest.image.agent.appium.http.AppiumGenericCommandHandler.lambda$executeCommand$1(AppiumGenericCommandHandler.java:314) at com.experitest.utils.background.BackgroundTasks$DelegatingRenamingCallable.call(BackgroundTasks.java:220) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) 2020-01-22 10:25:59,642 [Restlet-262045854-findElement-sid:8eb28255-2dc0-40e3-8fb7-52adc896dc89] (backend.commands.AppiumCommand) ERROR Exception of type 'com.experitest.image.agent.appium.backend.errors.STAppiumException' : An element could not be located on the page using the given search parameters (XPATH='//[@id='loginContinueButton']') com.experitest.image.agent.appium.backend.errors.STAppiumException: An element could not be located on the page using the given search parameters (XPATH='//[@id='loginContinueButton']') at com.experitest.image.agent.appium.backend.errors.STAppiumException.newNoSuchElementException(STAppiumException.java:143) at com.experitest.image.agent.appium.backend.commands.find.GeneralFindElementCommand.findElements(GeneralFindElementCommand.java:130) at com.experitest.image.agent.appium.backend.commands.find.GeneralFindElementCommand.findElements(GeneralFindElementCommand.java:61) at com.experitest.image.agent.appium.backend.commands.find.GeneralFindElementCommand.findElement(GeneralFindElementCommand.java:33) at com.experitest.image.agent.appium.backend.commands.find.FindElementCommand.doExecute(FindElementCommand.java:9) at com.experitest.image.agent.appium.backend.commands.AppiumCommand.execute(AppiumCommand.java:173) at com.experitest.image.agent.appium.http.AppiumGenericCommandHandler.lambda$executeCommand$1(AppiumGenericCommandHandler.java:314) at com.experitest.utils.background.BackgroundTasks$DelegatingRenamingCallable.call(BackgroundTasks.java:220) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) 2020-01-22 10:26:02,236 [Restlet-262045854-findElement-sid:8eb28255-2dc0-40e3-8fb7-52adc896dc89] (backend.commands.AppiumCommand) ERROR com.experitest.image.agent.appium.backend.errors.STAppiumException: An element could not be located on the page using the given search parameters (XPATH='//[@id='loginContinueButton']') com.experitest.image.agent.appium.backend.errors.STAppiumException: An element could not be located on the page using the given search parameters (XPATH='//[@id='loginContinueButton']') at com.experitest.image.agent.appium.backend.errors.STAppiumException.newNoSuchElementException(STAppiumException.java:143) at com.experitest.image.agent.appium.backend.commands.find.GeneralFindElementCommand.findElements(GeneralFindElementCommand.java:130) at com.experitest.image.agent.appium.backend.commands.find.GeneralFindElementCommand.findElements(GeneralFindElementCommand.java:61) at com.experitest.image.agent.appium.backend.commands.find.GeneralFindElementCommand.findElement(GeneralFindElementCommand.java:33) at com.experitest.image.agent.appium.backend.commands.find.FindElementCommand.doExecute(FindElementCommand.java:9) at com.experitest.image.agent.appium.backend.commands.AppiumCommand.execute(AppiumCommand.java:173) at com.experitest.image.agent.appium.http.AppiumGenericCommandHandler.lambda$executeCommand$1(AppiumGenericCommandHandler.java:314) at com.experitest.utils.background.BackgroundTasks$DelegatingRenamingCallable.call(BackgroundTasks.java:220) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) 2020-01-22 10:26:02,236 [Restlet-262045854-findElement-sid:8eb28255-2dc0-40e3-8fb7-52adc896dc89] (backend.commands.AppiumCommand) ERROR Exception of type 'com.experitest.image.agent.appium.backend.errors.STAppiumException' : An element could not be located on the page using the given search parameters (XPATH='//[@id='loginContinueButton']') com.experitest.image.agent.appium.backend.errors.STAppiumException: An element could not be located on the page using the given search parameters (XPATH='//[@id='loginContinueButton']') at com.experitest.image.agent.appium.backend.errors.STAppiumException.newNoSuchElementException(STAppiumException.java:143) at com.experitest.image.agent.appium.backend.commands.find.GeneralFindElementCommand.findElements(GeneralFindElementCommand.java:130) at com.experitest.image.agent.appium.backend.commands.find.GeneralFindElementCommand.findElements(GeneralFindElementCommand.java:61) at com.experitest.image.agent.appium.backend.commands.find.GeneralFindElementCommand.findElement(GeneralFindElementCommand.java:33) at com.experitest.image.agent.appium.backend.commands.find.FindElementCommand.doExecute(FindElementCommand.java:9) at com.experitest.image.agent.appium.backend.commands.AppiumCommand.execute(AppiumCommand.java:173) at com.experitest.image.agent.appium.http.AppiumGenericCommandHandler.lambda$executeCommand$1(AppiumGenericCommandHandler.java:314) at com.experitest.utils.background.BackgroundTasks$DelegatingRenamingCallable.call(BackgroundTasks.java:220) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) 2020-01-22 10:26:04,702 [Restlet-262045854-findElement-sid:8eb28255-2dc0-40e3-8fb7-52adc896dc89] (backend.commands.AppiumCommand) ERROR com.experitest.image.agent.appium.backend.errors.STAppiumException: An element could not be located on the page using the given search parameters (XPATH='//[@id='loginContinueButton']') com.experitest.image.agent.appium.backend.errors.STAppiumException: An element could not be located on the page using the given search parameters (XPATH='//[@id='loginContinueButton']') at com.experitest.image.agent.appium.backend.errors.STAppiumException.newNoSuchElementException(STAppiumException.java:143) at com.experitest.image.agent.appium.backend.commands.find.GeneralFindElementCommand.findElements(GeneralFindElementCommand.java:130) at com.experitest.image.agent.appium.backend.commands.find.GeneralFindElementCommand.findElements(GeneralFindElementCommand.java:61) at com.experitest.image.agent.appium.backend.commands.find.GeneralFindElementCommand.findElement(GeneralFindElementCommand.java:33) at com.experitest.image.agent.appium.backend.commands.find.FindElementCommand.doExecute(FindElementCommand.java:9) at com.experitest.image.agent.appium.backend.commands.AppiumCommand.execute(AppiumCommand.java:173) at com.experitest.image.agent.appium.http.AppiumGenericCommandHandler.lambda$executeCommand$1(AppiumGenericCommandHandler.java:314) at com.experitest.utils.background.BackgroundTasks$DelegatingRenamingCallable.call(BackgroundTasks.java:220) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) 2020-01-22 10:26:04,703 [Restlet-262045854-findElement-sid:8eb28255-2dc0-40e3-8fb7-52adc896dc89] (backend.commands.AppiumCommand) ERROR Exception of type 'com.experitest.image.agent.appium.backend.errors.STAppiumException' : An element could not be located on the page using the given search parameters (XPATH='//[@id='loginContinueButton']') com.experitest.image.agent.appium.backend.errors.STAppiumException: An element could not be located on the page using the given search parameters (XPATH='//[@id='loginContinueButton']') at com.experitest.image.agent.appium.backend.errors.STAppiumException.newNoSuchElementException(STAppiumException.java:143) at com.experitest.image.agent.appium.backend.commands.find.GeneralFindElementCommand.findElements(GeneralFindElementCommand.java:130) at com.experitest.image.agent.appium.backend.commands.find.GeneralFindElementCommand.findElements(GeneralFindElementCommand.java:61) at com.experitest.image.agent.appium.backend.commands.find.GeneralFindElementCommand.findElement(GeneralFindElementCommand.java:33) at com.experitest.image.agent.appium.backend.commands.find.FindElementCommand.doExecute(FindElementCommand.java:9) at com.experitest.image.agent.appium.backend.commands.AppiumCommand.execute(AppiumCommand.java:173) at com.experitest.image.agent.appium.http.AppiumGenericCommandHandler.lambda$executeCommand$1(AppiumGenericCommandHandler.java:314) at com.experitest.utils.background.BackgroundTasks$DelegatingRenamingCallable.call(BackgroundTasks.java:220) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) 2020-01-22 10:26:07,123 [Restlet-262045854-findElement-sid:8eb28255-2dc0-40e3-8fb7-52adc896dc89] (backend.commands.AppiumCommand) ERROR com.experitest.image.agent.appium.backend.errors.STAppiumException: An element could not be located on the page using the given search parameters (XPATH='//[@id='loginContinueButton']') com.experitest.image.agent.appium.backend.errors.STAppiumException: An element could not be located on the page using the given search parameters (XPATH='//[@id='loginContinueButton']') at com.experitest.image.agent.appium.backend.errors.STAppiumException.newNoSuchElementException(STAppiumException.java:143) at com.experitest.image.agent.appium.backend.commands.find.GeneralFindElementCommand.findElements(GeneralFindElementCommand.java:130) at com.experitest.image.agent.appium.backend.commands.find.GeneralFindElementCommand.findElements(GeneralFindElementCommand.java:61) at com.experitest.image.agent.appium.backend.commands.find.GeneralFindElementCommand.findElement(GeneralFindElementCommand.java:33) at com.experitest.image.agent.appium.backend.commands.find.FindElementCommand.doExecute(FindElementCommand.java:9) at com.experitest.image.agent.appium.backend.commands.AppiumCommand.execute(AppiumCommand.java:173) at com.experitest.image.agent.appium.http.AppiumGenericCommandHandler.lambda$executeCommand$1(AppiumGenericCommandHandler.java:314) at com.experitest.utils.background.BackgroundTasks$DelegatingRenamingCallable.call(BackgroundTasks.java:220) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) 2020-01-22 10:26:07,124 [Restlet-262045854-findElement-sid:8eb28255-2dc0-40e3-8fb7-52adc896dc89] (backend.commands.AppiumCommand) ERROR Exception of type 'com.experitest.image.agent.appium.backend.errors.STAppiumException' : An element could not be located on the page using the given search parameters (XPATH='//[@id='loginContinueButton']') com.experitest.image.agent.appium.backend.errors.STAppiumException: An element could not be located on the page using the given search parameters (XPATH='//[@id='loginContinueButton']') at com.experitest.image.agent.appium.backend.errors.STAppiumException.newNoSuchElementException(STAppiumException.java:143) at com.experitest.image.agent.appium.backend.commands.find.GeneralFindElementCommand.findElements(GeneralFindElementCommand.java:130) at com.experitest.image.agent.appium.backend.commands.find.GeneralFindElementCommand.findElements(GeneralFindElementCommand.java:61) at com.experitest.image.agent.appium.backend.commands.find.GeneralFindElementCommand.findElement(GeneralFindElementCommand.java:33) at com.experitest.image.agent.appium.backend.commands.find.FindElementCommand.doExecute(FindElementCommand.java:9) at com.experitest.image.agent.appium.backend.commands.AppiumCommand.execute(AppiumCommand.java:173) at com.experitest.image.agent.appium.http.AppiumGenericCommandHandler.lambda$executeCommand$1(AppiumGenericCommandHandler.java:314) at com.experitest.utils.background.BackgroundTasks$DelegatingRenamingCallable.call(BackgroundTasks.java:220) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) 2020-01-22 10:26:09,621 [Restlet-262045854-findElement-sid:8eb28255-2dc0-40e3-8fb7-52adc896dc89] (backend.commands.AppiumCommand) ERROR com.experitest.image.agent.appium.backend.errors.STAppiumException: An element could not be located on the page using the given search parameters (XPATH='//[@id='loginContinueButton']') com.experitest.image.agent.appium.backend.errors.STAppiumException: An element could not be located on the page using the given search parameters (XPATH='//[@id='loginContinueButton']') at com.experitest.image.agent.appium.backend.errors.STAppiumException.newNoSuchElementException(STAppiumException.java:143) at com.experitest.image.agent.appium.backend.commands.find.GeneralFindElementCommand.findElements(GeneralFindElementCommand.java:130) at com.experitest.image.agent.appium.backend.commands.find.GeneralFindElementCommand.findElements(GeneralFindElementCommand.java:61) at com.experitest.image.agent.appium.backend.commands.find.GeneralFindElementCommand.findElement(GeneralFindElementCommand.java:33) at com.experitest.image.agent.appium.backend.commands.find.FindElementCommand.doExecute(FindElementCommand.java:9) at com.experitest.image.agent.appium.backend.commands.AppiumCommand.execute(AppiumCommand.java:173) at com.experitest.image.agent.appium.http.AppiumGenericCommandHandler.lambda$executeCommand$1(AppiumGenericCommandHandler.java:314) at com.experitest.utils.background.BackgroundTasks$DelegatingRenamingCallable.call(BackgroundTasks.java:220) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) 2020-01-22 10:26:09,622 [Restlet-262045854-findElement-sid:8eb28255-2dc0-40e3-8fb7-52adc896dc89] (backend.commands.AppiumCommand) ERROR Exception of type 'com.experitest.image.agent.appium.backend.errors.STAppiumException' : An element could not be located on the page using the given search parameters (XPATH='//[@id='loginContinueButton']') com.experitest.image.agent.appium.backend.errors.STAppiumException: An element could not be located on the page using the given search parameters (XPATH='//[@id='loginContinueButton']') at com.experitest.image.agent.appium.backend.errors.STAppiumException.newNoSuchElementException(STAppiumException.java:143) at com.experitest.image.agent.appium.backend.commands.find.GeneralFindElementCommand.findElements(GeneralFindElementCommand.java:130) at com.experitest.image.agent.appium.backend.commands.find.GeneralFindElementCommand.findElements(GeneralFindElementCommand.java:61) at com.experitest.image.agent.appium.backend.commands.find.GeneralFindElementCommand.findElement(GeneralFindElementCommand.java:33) at com.experitest.image.agent.appium.backend.commands.find.FindElementCommand.doExecute(FindElementCommand.java:9) at com.experitest.image.agent.appium.backend.commands.AppiumCommand.execute(AppiumCommand.java:173) at com.experitest.image.agent.appium.http.AppiumGenericCommandHandler.lambda$executeCommand$1(AppiumGenericCommandHandler.java:314) at com.experitest.utils.background.BackgroundTasks$DelegatingRenamingCallable.call(BackgroundTasks.java:220) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) 2020-01-22 11:21:56,123 [pool-14-thread-1--Open device emulator-5554] (device.android.LocalShellService) ERROR Exception caught during executing shell pm uninstall com.experitest.uiautomator.test :- Exception occurred while dumping: java.lang.IllegalArgumentException: Unknown package: com.experitest.uiautomator.test at com.android.server.pm.Settings.isOrphaned(Settings.java:4134) at com.android.server.pm.PackageManagerService.isOrphaned(PackageManagerService.java:18105) at com.android.server.pm.PackageManagerService.deletePackage(PackageManagerService.java:15522) at com.android.server.pm.PackageInstallerService.uninstall(PackageInstallerService.java:888) at com.android.server.pm.PackageManagerShellCommand.runUninstall(PackageManagerShellCommand.java:792) at com.android.server.pm.PackageManagerShellCommand.onCommand(PackageManagerShellCommand.java:118) at android.os.ShellCommand.exec(ShellCommand.java:94) at com.android.server.pm.PackageManagerService.onShellCommand(PackageManagerService.java:18363) at android.os.Binder.shellCommand(Binder.java:468) at android.os.Binder.onTransact(Binder.java:367) at android.content.pm.IPackageManager$Stub.onTransact(IPackageManager.java:2387) at com.android.server.pm.PackageManagerService.onTransact(PackageManagerService.java:3031) at android.os.Binder.execTransact(Binder.java:565)

Dyanamic: true Device: adb:Android SDK built for x86 Application: APPLICATION URL: null Is Continue: false Instrumented: false Outsid app: false

Get all records Get all records Get all records Get all records Get all records Get all records Get all records Get all records Get all records Get all records `

Shahin-M2M commented 4 years ago

Could you attach the full log?

It seems like the elements are not found!

Yes, it looks you got no element.

[HTTP] --> POST /wd/hub/session/1b16627d-2be8-429f-a3ac-b6096bed9369/element [HTTP] {"using":"xpath","value":"//[@id='loginWelcomeScreenTitle']"} [debug] [W3C (1b16627d)] Calling AppiumDriver.findElement() with args: ["xpath","//[@id='loginWelcomeScreenTitle']","1b16627d-2be8-429f-a3ac-b6096bed9369"] [debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator [debug] [BaseDriver] Waiting up to 0 ms for condition [debug] [WD Proxy] Matched '/element' to command name 'findElement' [debug] [WD Proxy] Proxying [POST /element] to [POST http://127.0.0.1:8202/wd/hub/session/8dfb5df6-7e27-4b4d-8218-4bf672e6fc7a/element] with body: {"strategy":"xpath","selector":"//*[@id='loginWelcomeScreenTitle']","context":"","multiple":false} [WD Proxy] Got an unexpected response with status 404: {"sessionId":"8dfb5df6-7e27-4b4d-8218-4bf672e6fc7a","value":{"error":"no such element","message":"An element could not be located on the page using the given search parameters","stacktrace":"io.appium.uiautomator2.common.exceptions.ElementNotFoundException: An element could not be located on the page using the given search parameters\n\tat io.appium.uiautomator2.handler.FindElement.findElement(FindElement.java:102)\n\tat io.appium.uiautomator2.handler.FindElement.safeHandle(FindElement.java:72)\n\tat io.appium.uiautomator2.handler.request.SafeRequestHandler.handle(SafeRequestHandler.java:38)\n\tat io.appium.uiautomator2.server.AppiumServlet.handleRequest(AppiumServlet.java:252)\n\tat io.appium.uiautomator2.server.AppiumServlet.handleHttpRequest(AppiumServlet.java:242)\n\tat io.appium.uiautomator2.http.ServerHandler.channelRead(ServerHandler.java:51)\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:366)\n\tat io.netty.channel.AbstractChannelHandlerCon... [debug] [W3C] Matched W3C error code 'no such element' to NoSuchElementError [debug] [W3C (1b16627d)] Encountered internal error running command: NoSuchElementError: An element could not be located on the page using the given search parameters. [debug] [W3C (1b16627d)] at AndroidUiautomator2Driver.findElOrEls (/usr/local/Cellar/appium/1.16.0/libexec/lib/node_modules/appium/node_modules/appium-android-driver/lib/commands/find.js:75:11) [HTTP] <-- POST /wd/hub/session/1b16627d-2be8-429f-a3ac-b6096bed9369/element 404 40 ms - 416

Shahin-M2M commented 4 years ago

An update: find_element(:xpath, "//*[@text='Login']").click works,

but changing text into id for the same element throws error: find_element(:xpath, "//*[@id='loginWelcomeLoginButton']").click An element could not be located on the page using the given search parameters. (Selenium::WebDriver::Error::NoSuchElementError)

KazuCocoa commented 4 years ago

Hm, it looks the result of find_element(:xpath, "//*[@id='loginWelcomeLoginButton']") different from the real device and the emulator. The case could happen, but it depends on Android OS side. Probably nothing can do in appium side, unfortunately

Does source result have the element?

Shahin-M2M commented 4 years ago

Hm, it looks the result of find_element(:xpath, "//*[@id='loginWelcomeLoginButton']") different from the real device and the emulator. The case could happen, but it depends on Android OS side. Probably nothing can do in appium side, unfortunately

Does source result have the element?

Does source result have the element? -> YES

and when i open the emulator with AppiumStudio and inspect the elements, everything seems to be same as device.

I even tried with an emulator same as the real device (both Pixel 3 API 27), but steel there seems to be a difference in device and emulator searching for elements.

KazuCocoa commented 4 years ago

uia2 gets elements via AccessibilityNodeInfo by Android. If AS does not use the API, the result could be different. You can also use espresso driver to get elements via espresso API.

Shahin-M2M commented 4 years ago

For everyone with the same problem, after 2 days researching and a lot of testing:

On emulator you can just search for the resource-id. find_element(xpath:, "//*[@resource-id='PACKAGE_NAME:id/ELEMENT_ID']")

Thank you @KazuCocoa for your quick response.