Appium: Appium from 1.7.1 update to 1.8.1, find_element_by_id doesn't work

Created on 14 Jun 2018  ·  58Comments  ·  Source: appium/appium

When i update to 1.8.1, the 'find_element_by_id' has an error. The code is
self.driver.find_element_by_id("com.hlg.daydaytobusiness:id/rl_new_vip").click()
error :
image
image

NotABug

Most helpful comment

In my case upgrading appium-python-client from 0.20 to 0.28 done the trick

pip install Appium-Python-Client --upgrade

All 58 comments

One can only find elements by css inside webview context. In native context such locators are supposed to fail.

First,the same code in 1.7.1 is good but in 1.8.1 is error. Second, 'find_element_by_id' doesn't set up the webview context.

It might be a problem with selenium's python API as well that it somehow rewrites the selector, but what I see in the attached Appium log is the expected behaviour.

My guess is correct. Selenium API simply forcefully rewrites all selectors to CSS:
https://github.com/SeleniumHQ/selenium/blob/2c2db8a47b72b1e9d1c380b4e8664de1b13ebada/py/selenium/webdriver/remote/webelement.py#L667

🤦‍♂️

I changed the code like the below to catch up with W3C spec in Appium server. So, current master branch should work well.
https://github.com/appium/python-client/blob/1923f6f35180186ad9da3284dab636743f00446a/appium/webdriver/webdriver.py#L204

Ah... but I haven't changed webelement.py...

Ruby client also changes as same in selenium-webdriver. So, I also have implemented not to change in Appium x W3C spec case.

Issue is reproducible now on new Appium 1.9.0 [PYTHON scripts]

I find all elements find by ID. In some specific cases it is XPATH. But never by CSS.
Appium changes that find_by_id (PYTHON) to :

[W3C] Calling AppiumDriver.findElement() with args: ["css selector","[id="btnBottom"]","5c23cfbc-1171-469f-930f-18a848f60409"]

I will copy whole log here:

[debug] [W3C] Calling AppiumDriver.findElement() with args: ["css selector","[id=\"OK\"]","97e16395-0af5-4bc2-a970-7451ba87f0d0"]
[debug] [XCUITest] Executing command 'findElement'
[debug] [BaseDriver] Valid locator strategies for this request: xpath, id, name, class name, -ios predicate string, -ios class chain, accessibility id
[W3C] Encountered internal error running command: InvalidSelectorError: Locator Strategy 'css selector' is not supported for this session
[W3C] at XCUITestDriver.validateLocatorStrategy (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/basedriver/driver.js:349:13)
[W3C] at XCUITestDriver.validateLocatorStrategy (/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/lib/driver.js:111:21)
[W3C] at XCUITestDriver.callee$0$0$ (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/basedriver/commands/find.js:26:8)
[W3C] at tryCatch (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
[W3C] at GeneratorFunctionPrototype.invoke [as _invoke] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
[W3C] at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
[W3C] at invoke (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
[W3C] at enqueueResult (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:185:17)
[W3C] at new Promise ()
[W3C] at new F (/usr/local/lib/node_modules/appium/node_modules/core-js/library/modules/$.export.js:30:36)
[W3C] at AsyncIterator.enqueue (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:184:12)
[W3C] at AsyncIterator.prototype.(anonymous function) [as next] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
[W3C] at Object.runtime.async (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:209:12)
[W3C] at XCUITestDriver.callee$0$0 [as findElOrElsWithProcessing] (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/build/lib/basedriver/commands/find.js:47:30)
[W3C] at XCUITestDriver.callee$0$0$ (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/basedriver/commands/find.js:46:21)
[W3C] at tryCatch (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
[W3C] at GeneratorFunctionPrototype.invoke [as _invoke] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
[W3C] at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
[W3C] at invoke (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
[W3C] at enqueueResult (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:185:17)
[W3C] at new Promise ()
[W3C] at new F (/usr/local/lib/node_modules/appium/node_modules/core-js/library/modules/$.export.js:30:36)
[W3C] at AsyncIterator.enqueue (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:184:12)
[W3C] at AsyncIterator.prototype.(anonymous function) [as next] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
[W3C] at Object.runtime.async (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:209:12)
[W3C] at XCUITestDriver.callee$0$0 [as findElement] (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/build/lib/basedriver/commands/find.js:88:30)
[W3C] at /usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/basedriver/driver.js:296:26
[W3C] at tryCatcher (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/node_modules/bluebird/js/main/util.js:26:23)
[W3C] at Promise._settlePromiseFromHandler (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/node_modules/bluebird/js/main/promise.js:510:31)
[W3C] at Promise._settlePromiseAt (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/node_modules/bluebird/js/main/promise.js:584:18)
[W3C] at Promise._settlePromiseAtPostResolution (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/node_modules/bluebird/js/main/promise.js:248:10)
[W3C] at Async._drainQueue (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/node_modules/bluebird/js/main/async.js:128:12)
[W3C] at Async._drainQueues (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/node_modules/bluebird/js/main/async.js:133:10)
[W3C] at Immediate.Async.drainQueues (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/node_modules/bluebird/js/main/async.js:15:14)
[W3C] at runCallback (timers.js:696:18)
[W3C] at tryOnImmediate (timers.js:667:5)
[W3C] at processImmediate (timers.js:649:5)
[HTTP] <-- POST /wd/hub/session/97e16395-0af5-4bc2-a970-7451ba87f0d0/element 400 17 ms - 4797

@dragan-test Which Python client version did you use?

@KazuCocoa

  • Appium-Python-Client in /usr/local/lib/python3.7/site-packages (0.28)
  • selenium>=2.47.0 in /usr/local/lib/python3.7/site-packages (from Appium-Python-Client) (3.14.0)
  • urllib3 in /usr/local/lib/python3.7/site-packages (from selenium>=2.47.0->Appium-Python-Client) (1.23)

I hope this answers your question.

Thanks. it is.

In W3C protocol x native context locator, we've ignored converter to css selector.
https://github.com/appium/python-client/blob/3224f5a5d65fe81ff6aba6eb16e675daf1a17c1c/appium/webdriver/webdriver.py#L207

Since Selenium Webdriver convert some strategy to css selector in W3C protocol.
https://github.com/SeleniumHQ/selenium/blob/03bb202f3fb704d2ffca99527bfd5ffbab7dd08c/py/selenium/webdriver/remote/webdriver.py#L985 As you mentioned, find_by_id can convert to

Python client 0.28 has the change.

@dragan-test
Ah... Did you call the element like element.find_element_by_id("xxx")? Not driver.find_element_by_id("xxx").
In the case, the converter works as same as selenium-webdriver.
https://github.com/SeleniumHQ/selenium/blob/03bb202f3fb704d2ffca99527bfd5ffbab7dd08c/py/selenium/webdriver/remote/webelement.py#L630-L680 .

@dragan-test if your issue is the above, https://github.com/appium/python-client/pull/251 probably helps you.
(I haven't added and tested it well yet though.)

@KazuCocoa
I call element as self.driver.find_element_by_id("some_id")
Also, I defined elements in POM classes as:

def ok_popup_button(self):
    return WebDriverWait(self.driver, Constants.wait_time).until(
        EC.presence_of_element_located((By.ID, "OK")))

and then I just call them and performing action on them
self.ok_popup_button().click()

P.S.
I also tried with v1.9.1-beta2 appium version - same issue exist

Thanks. I'll check again later.

@dragan-test
If you have a chance, can you share your creating driver phase in your test code like below?
https://github.com/appium/python-client/blob/master/test/functional/ios/appium_tests.py#L23-L27

from appium import webdriver
import desired_capabilities

class AppiumTests(unittest.TestCase):
    def setUp(self):
        desired_caps = desired_capabilities.get_desired_capabilities('UICatalog.app.zip')
        self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)
...

Because I'd like to know how to create and use the driver to reproduce your case.

Hi @KazuCocoa
Here it is:

from appium import webdriver
import hgaconfig.DesiredCaps

class Joingame_test(unittest.TestCase):
    def setUp(self):
        self.driver = webdriver.Remote('http://localhost:4723/wd/hub', hgaconfig.DesiredCaps.DesiredCaps.desired_caps_ios)
        self.driver.implicitly_wait(10)

Also, desired capabilities are like:

# DESIRED CAPABILITIES FOR IPHONE SIMULATOR
    desired_caps_ios = {}
    desired_caps_ios['platformName'] = 'iOS'
    desired_caps_ios['platformVersion'] = '11.4'
    desired_caps_ios['deviceName'] = 'iPhone 7'
    desired_caps_ios['automationName'] = 'XCUITest'
    desired_caps_ios['app'] = '/Users/nnn/Documents/app file/nnn.app'
    desired_caps_ios['wdaLocalPort'] = 8100

https://github.com/appium/python-client/blob/master/test/functional/ios/find_by_ios_class_chain_tests.py base below change worked in my environment. (selenium 3.14.0 and 3.10.0)

 from appium import webdriver
 import desired_capabilities
-
+from selenium.webdriver.support import expected_conditions as EC
+from selenium.webdriver.support.ui import WebDriverWait
+from selenium.webdriver.common.by import By

 class FindByIOClassChainTests(unittest.TestCase):
     @classmethod
     def setUpClass(self):
         desired_caps = desired_capabilities.get_desired_capabilities('UICatalog.app.zip')
         self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)
+        self.driver.implicitly_wait(10)

     @classmethod
     def tearDownClass(self):
         self.driver.quit()

     def test_find_element_by_path(self):
-        el = self.driver.find_element_by_ios_class_chain('XCUIElementTypeWindow/**/XCUIElementTypeStaticText')
-        self.assertEqual('UICatalog', el.get_attribute('name'))
+        self.driver.find_element_by_id("UICatalog")
+        WebDriverWait(self.driver, 3).until(EC.presence_of_element_located((By.ID, "UICatalog")))
+

     def test_find_multiple_elements_by_path(self):
         el = self.driver.find_elements_by_ios_class_chain('XCUIElementTypeWindow/*/*/*')

It worked with library update, although my command had to be:

sudo gem install -n /usr/local/bin --no-rdoc --no-ri appium_lib due to permissions issues.

Regular command can give error:
gem install --no-rdoc --no-ri appium_lib
_Fetching: nokogiri-1.8.4.gem (100%)
ERROR: While executing gem … (Gem::FilePermissionError)
You don’t have write permissions for the /Library/Ruby/Gems/2.3.0 directory._

The permission issue is a general topic in bundler and your environment.

It worked with library update

I'm confusing a bit... After updating the Python library, the issue you mentioned the above has been fixed? Or did you use Ruby client instead of python?

Hi @KazuCocoa
Apologies if I wrote something confusing, I'm not _pro_ in this world.
Anyhow, after this command gem install --no-rdoc --no-ri appium_lib issue doesn't exist anymore.
As I can see in PyCharm where I executing tests, Appium-Python-Client is stated first (so if this command added ruby client then I don't know the impact).
client

I also noticed now that my _mobile / web parallel_ test doesn't work anymore since import
from selenium import webdriver doesn't work for mobile (iOS simulator)

I had this type of test:

from selenium import webdriver
class Web_and_mob(unittest.TestCase):
    def setUp(self):
        self.driver = webdriver.Remote('http://localhost:4723/wd/hub', hgaconfig.DesiredCaps.DesiredCaps.desired_caps_ios)
        self.wd = webdriver.Chrome()

And now this is not working anymore, I need to change to
from appium import webdriver
and then ChromeDriver is not working. That was the impact of all of this.

I see. Never mind.

ChromeDriver is provided by SeleniumWebdriver, right? In the case, Appium driver can't work for it.
You should manage selenium/appium clients to fit each driver, Selenium with Chrome and Appium with iOS.

I met the same issue with Appium v1.9.0 in Java-Android 7.0, but when I downgrade it to 1.8.1, it solved

mm.
If it happens in Python and Java client, the error happens in Appium server, I assume.
I haven't met it, so, if you can, could you attach your server logs which is the error case to make sure the behaviour entirely? @hnkhuy

Yes, but I'm using v1.8.1 with my task now. When I have time, I will re-install Appium v1.9.0, run and send my server logs for you here. @KazuCocoa

Thanks @hnkhuy

I have the same problems.

  • Using Appium 1.7.0/Server v1.9.0 with Robotframework test for Android apps.
  • I'm using ID locators, ex:
    Wait Until Element Is Visible id=${appPackagename}:id/welcome_section_top_empty
  • When running the test, I get error:
    InvalidSelectorException: Message: Locator Strategy 'css selector' is not supported for this session

  • I tried going back to Appium 1.6.3/Server v1.8.1, but then I have another problem running test for iOS apps. As soon as I start the tests, I get:
    WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: Xcode version '0.0'. Support for Xcode 0.0 is not supported. Please upgrade to version 7.3 or higher

  • The same iOS test will run fine with Appium 1.7.0/Server v1.9.0

@dflageol

  • What version of python-client used in Robotframework?

    • The version should be 0.28+. The root cause of converting locators are selenium-webdriver side. 0.28 has no such process.
  • I tried going back to Appium 1.6.3/Server v1.8.1

@dflageol

  • What version of python-client used in Robotframework?

    • The version should be 0.28+. The root cause of converting locators are selenium-webdriver side. 0.28 has no such process.
  • I tried going back to Appium 1.6.3/Server v1.8.1

Thank you for your help KazuCocoa

  • python-client, not sure, good question, but python -v command gives me: Python 2.7.13
  • Yes Xcode 10 works with Appium 1.9.0, that's fine, but then when running Android tests I get error:
    InvalidSelectorException: Message: Locator Strategy 'css selector' is not supported for this session

Basically I'm trying to stay up to date but would like to run all my robotframework tests (Web, Android apps and iOS apps) to work running only one version of Appium/Appium server

pip show robotframework

  • Name: robotframework
  • Version: 3.0.2
  • Summary: A generic test automation framework
  • Home-page: http://robotframework.org
  • Author: Robot Framework Developers
  • Author-email: [email protected]
  • License: Apache License 2.0
  • Location: /usr/local/lib/python2.7/site-packages
  • Requires:
  • Required-by: robotframework-sshlibrary, robotframework-selenium2library, robotframework-requests, robotframework-appiumlibrary

pip install Appium-Python-Client

  • Requirement already satisfied: Appium-Python-Client in /usr/local/lib/python2.7/site-packages (0.24)
  • Requirement already satisfied: selenium>=2.47.0 in /usr/local/lib/python2.7/site-packages (from Appium-Python-Client) (3.14.0)
  • Requirement already satisfied: urllib3 in /usr/local/lib/python2.7/site-packages/urllib3-1.21.1-py2.7.egg (from selenium>=2.47.0->Appium-Python-Client) (1.21.1)

So I guess I need to replace site-packages (0.24) ?

Yes, it seems to work, thank you @KazuCocoa!

Solution:

  1. Delete /usr/local/lib/python2.7/site-packages/Appium_Python_Client-0.24.dist-info
  2. pip install Appium-Python-Client

Fix for Java (1.8.0_172):

appium-server-logs.txt
inteillj-error-logs.txt
Hi @KazuCocoa, I attach server log and error log,
Running info:

  • Appium v1.9.0(install from appium-desktop-setup-1.7.0.exe- I cannot install appium-desktop-Setup-1.7.0-ia32.exe successful in my PC)
  • Apk version 7.0- You can get my demo project with .apk here
  • Device: Android emulator Google Nexus 5X, Android 7.0- API 24, CPU x86
  • Error code line: driver.findElement(By.id("buttonPlus"));
    Hope you can reproduce and find a solution, tks!

Thanks.
@hnkhuy Which appium java client version do you use? If you use before 6.0 ( https://github.com/appium/java-client/releases ), could you try the latest 6.1.0?

I found 3.4.0 number in your log. I guess your appium java client is old one since the latest Java client uses selenium 3.14.0.

\Users\huy.huynh\.m2\repository\org\seleniumhq\selenium\selenium-api\3.4.0\selenium-api-3.4.0.jar;C:\Users\huy.huynh\.m2\repository\org\testng\testng\6.9.4\testng-6.9.4.jar;C:\Users\huy.huynh\.m2\repository\org\beanshell\bsh\2.0b4\bsh-2.0b4.jar;C:\Users\huy.huynh\.m2\repository\com\beust\jcommander\1.48\jcommander-1.48.jar;C:\Users\huy.huynh\.m2\repository\org\seleniumhq\selenium\selenium-remote-driver\3.4.0\selenium-remote-driver-3.4.0.jar;

@KazuCocoa
Actually, I do not have any Appium dependency(I use Maven) before (And it still run successfully in v1.8.1- All library required when I copy and parse code from tutorial just required some lib like RemoteWebDriver... Am I wrong somewhere?).
Just manual add to pom.xml
<dependency> <groupId>io.appium</groupId> <artifactId>java-client</artifactId> <version>6.1.0</version> </dependency>
And I also updated all Selenium dependency to 3.14.0
But this issue still happen

@hnkhuy

I do not have any Appium dependency

Do you mean you ran your code with vanilla selenium java client? In the case, the converting to css selector should happen.

Like https://github.com/appium/appium/blob/master/sample-code/java/src/AndroidSelectorsTest.java#L28 , you should invoke io.appium.java_client.android.AndroidDriver to create driver instance in Android case. In this case, such css selector shouldn't happen.

Which tutorial did you follow? if it was in http://appium.io/docs/en/about-appium/intro/ , I think we should make sure it...

@KazuCocoa
I changed RemoteWebDriver->AndroidDriver and it works well
My misunderstanding, I will read more about Appium's drivers
Tks a lot for supporting me these days :D

@KazuCocoa I see the same error mentioned at the start of the thread after upgrading to 1.7. I have java client version 6.1.0 and this is on IOS.

Can you share your Java code you ran? @Madhavip3
Sometimes, users run tests with selenium driver. in the case, this should happen.

We are using RemoteWebDriver .I also tried with AppiumDriver. Our application is an IOS application and we test it out on iPads.
currentSession.findElement(By.id(id)).click() --> this is how we are accessing the elements in the app and after the recent update of Appium , I get "Encountered internal error running command: InvalidSelectorError: Locator Strategy 'css selector' is not supported for this session" .
This was working fine before the update.

@mykola-mokhnach @KazuCocoa

In my case upgrading appium-python-client from 0.20 to 0.28 done the trick

pip install Appium-Python-Client --upgrade

Did you try IOSDriver like https://github.com/appium/appium/blob/master/sample-code/java/src/IOSCreateSessionTest.java for iOS and findElementById()? @Madhavip3

If the error happens even you use the latest client version, could you report it in https://github.com/appium/java-client ?

This issue is happening in Appium 1.9.1/Appium Desktop 1.7.1 when testing Android applications with UIAutomator2. Is there a fix? I'm using AndroidDriver in C#.

@KazuCocoa - Should this breaking change be reverted?

This is client side issue.
The client should be fixed properly. I forget if C# has the fix though...

hello, I know it may seem silly but what happened to me was that in the dependencies of the pom do not update the version of appium (facepalm)

What about calling below as a hotfix in C# ? @ronjonesjr

c# FindElement("id", "some ids") FindElement("name", "some names") FindElement("class name", "some class names")

I read C# selenium code. It probably works skipping the css converting process.

The same issue for Java client:

Server: v1.9.1

Client:
Gradle dependencies:

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'io.appium:java-client:6.1.0'
    implementation group: 'junit', name: 'junit', version: '4.12'
}

Test class:

public class CallTest {

  WebDriver driver;

  @Before
  public void setUp() throws MalformedURLException {
    // Created object of DesiredCapabilities class.
    DesiredCapabilities capabilities = new DesiredCapabilities();

    // Set android deviceName desired capability. Set your device name.
    capabilities.setCapability("deviceName", "XT1562");

    // Set android VERSION desired capability. Set your mobile device's OS version.
    capabilities.setCapability(CapabilityType.VERSION, "6.0.1");

    // Set android platformName desired capability. It's Android in our case here.
    capabilities.setCapability("platformName", "Android");

    // Set android appPackage desired capability. It is
    // com.android.calculator2 for calculator application.
    // Set your application's appPackage if you are using any other app.
    capabilities.setCapability("appPackage", "com.android.calculator2");

    // Set android appActivity desired capability. It is
    // com.android.calculator2.Calculator for calculator application.
    // Set your application's appPackage if you are using any other app.
    capabilities.setCapability("appActivity", "com.android.calculator2.Calculator");

    // Created object of RemoteWebDriver will all set capabilities.
    // Set appium server address and port number in URL string.
    // It will launch calculator app in android device.
    driver = new RemoteWebDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
    driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);
  }

  @Test
  public void testFirstCalculator() {

    // Click on DELETE/CLR button to clear result text box before running test.
    driver.findElements(By.xpath("//android.widget.Button")).get(0).click();

    // Click on number 2 button.
    driver.findElement(By.name("7")).click();

    driver.manage().timeouts().implicitlyWait(30,TimeUnit.SECONDS);
  }

  @After
  public void End() {
    driver.quit();
  }
}

Logs:

Connected to the target VM, address: '127.0.0.1:50981', transport: 'socket'
окт 12, 2018 11:20:41 AM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C

org.openqa.selenium.InvalidSelectorException: Locator Strategy 'css selector' is not supported for this session
For documentation on this error, please visit: http://seleniumhq.org/exceptions/invalid_selector_exception.html
Build info: version: '3.12.0', revision: '7c6e0b3', time: '2018-05-08T14:04:26.12Z'
System info: host: 'MacBook-Pro-Artur.local', ip: 'fe80:0:0:0:1c4d:f85:b7f3:e683%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.13.6', java.version: '1.8.0_152-release'
Driver info: org.openqa.selenium.remote.RemoteWebDriver
Capabilities {appActivity: com.android.calculator2.Cal..., appPackage: com.android.calculator2, databaseEnabled: false, desired: {appActivity: com.android.calculator2.Cal..., appPackage: com.android.calculator2, deviceName: XT1562, platformName: android, version: 6.0.1}, deviceManufacturer: Google, deviceModel: Android SDK built for x86, deviceName: emulator-5554, deviceScreenSize: 1080x1920, deviceUDID: emulator-5554, javascriptEnabled: true, locationContextEnabled: false, networkConnectionEnabled: true, platform: LINUX, platformName: LINUX, platformVersion: 9, takesScreenshot: true, version: 6.0.1, warnings: {}, webStorageEnabled: false}
Session ID: b5ac1fc6-b513-4f31-8e21-e2dfc877cb86
*** Element info: {Using=name, value=7}

    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:187)
    at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:122)
    at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49)
    at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:543)
    at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:317)
    at org.openqa.selenium.remote.RemoteWebDriver.findElementByName(RemoteWebDriver.java:395)
    at org.openqa.selenium.By$ByName.findElement(By.java:284)
    at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:309)
    at me.vyng.tests.CallTest.testFirstCalculator(CallTest.java:63)

@KazuCocoa Still see the issue even after using IOSDriver. Raised a bug https://github.com/appium/java-client/issues/1047 at the client side.

thanks, I see. Asking in the client repository is proper.

@Gaket Did you find any solution to that?

Hi, Any updates regarding this issue? I'm facing same issue in Appium 1.9.1/Appium Desktop 1.7.1 while testing Android applications with UIAutomator2. I'm using AndroidDriver in C#

Could you read https://github.com/appium/appium-dotnet-driver/issues/266#issuecomment-429854281 ? @walidahmedelsayed
Try driver.FindElementById instead of driver.FindElement(By.Id(...)) style with the latest client

@KazuCocoa Thanks for the quick response, I will try it.

@KazuCocoa It Works ! . are they going to fix this issue in the next release or it will be the final implementation ?

What do you mean the next release? (Do you expect this issue is server side?)
This issue is client side one. The latest #C can work means the version is the fixed version :)
@walidahmedelsayed

@KazuCocoa Sorry for misunderstanding, But I am using the latest appium-dotnet-driver 4.0.0.4 beta and facing this issue.

So,

It Works !

Did you mean it worked updating Appium server from 1.9.1 to @beta?
(Some API for Web Context, has not implemented W3C spec yet, can fix this.)

Or do you mean when driver.FindElement(By.Id(...)) style will be fixed as well as driver.FindElementById?

If you meant the later, we'll probably guide using farmer way with the latest client for a while. (Wellcome to the fixing PR though :) )

This bug (or a similar one) seems to have been reintroduced in version 1.10.0, I get this error:

nested exception is org.openqa.selenium.InvalidSelectorException: Locator Strategy 'css selector' is not supported for this session

More info:
Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: protected ....app.login.pre.PreLoginScreen ....mobile.MobileTest.preLoginScreen; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'existingTab' defined in file [...login\pre\ExistingTab.class]: Initialization of bean failed; nested exception is org.openqa.selenium.InvalidSelectorException: Locator Strategy 'css selector' is not supported for this session For documentation on this error, please visit: http://seleniumhq.org/exceptions/invalid_selector_exception.html Build info: version: '3.4.0', revision: 'unknown', time: 'unknown' System info: host: 'MYMACHINE', ip: '10.0.0.1', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_181'

Downgrading to 1.8.1 - 1.9.1 resolves the issue.

Did you reproduce it with the latest java-client via jitpack (not from Maven)?

That is basically a client-side issue since W3C adaptation is not enough.
(Or clients use pure selenium driver class, not Appium class, like RemoteWebDriver in Java instead of AndroidDriver.

I was able to resolve this issue by upgrading Appium-Python-Client , my current version was 0.26

This will work fir Robotframework as well
pip install Appium-Python-Client --upgrade

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings