The session does not support the 'css selector' Locator Strategy Exception error occurred when attempting to locate an instance of EditText using Appium in C#

Successfully opened my app using Appium in C#. Now, on the loginPage, I am trying to retrieve the EditText element in order to input the userName.

I have attempted various methods, but they all seem to be causing issues. Here is a snippet of my code:

public class UnitTest1
{
    private AndroidDriver<AndroidElement> driver;
    private DesiredCapabilities capabilities;

    [SetUp]
    public void InItDriver()
    {
        capabilities = new DesiredCapabilities();          
        capabilities.SetCapability("deviceName", "ZZ2222HMLF");
       //capabilities.SetCapability("[platformName", "Android");
        capabilities.SetCapability("noReset", true);
        capabilities.SetCapability("autoGrantPermissions", "true");
        capabilities.SetCapability("appPackage", "com.sisapp.in.lgm");
        capabilities.SetCapability("automationName", "UiAutomator2");
        capabilities.SetCapability("appActivity", "md5b1afd03e09ce5243fd0287b176ff38ea.SplashActivity");
        driver = new AndroidDriver<AndroidElement>(new Uri("http://127.0.0.1:4723/wd/hub"), capabilities);
        //driver = new AndroidDriver<AndroidElement>(new Uri("https:127.0.0.1:4723/wd/hub"), capabilities);
    }
    [Test]
    public void Test1()
    {
       AndroidElement textView = driver.FindElementById("input_name");      
       textView.SendKeys("ak@ct");
       Assert.IsNotNull(driver);
       System.Threading.Thread.Sleep(2000);
    }

    [TearDown]
    public void CloseTest()
    {
        //driver.Quit();
    }
}

An exception is being thrown:

Message: OpenQA.Selenium.InvalidSelectorException : Locator Strategy 'css selector' is not supported for this session

How can I resolve this issue?

Answer №1

It seems like the issue you're experiencing could be due to a conflicting selenium dependency version. It's possible that your client already has a selenium dependency and adding an older version is causing confusion.

https://example.com/johndoe/abc123

Answer №2

The issue at hand has been successfully addressed by carrying out the following steps in the command line interface:

Resolution:

npm uninstall -g appium
npm install -g <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="dfbeafafb6aab29feef1e8f1ed">[email protected]</a> --no-shrinkwrap

I stumbled upon the solution here.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What steps should I take to update the path and locate the geckodriver on my system?

I'm a complete beginner in the programming world. After researching for hours, I managed to fix most errors except one. It seems simple, but I can't figure it out. I tried to use selenium to open a webpage. from selenium import webdriver driver ...

Form validation on the client side: A way to halt form submission

I have a form with several textboxes. The unobtrusive jquery validation is functioning properly and correctly turns the boxes red when invalid values are entered. However, I've noticed that when I click to submit the form, it gets posted back to the s ...

Mastering the art of splitting data into various types with a Fluent API

As part of a project involving Selenium UI testing, I am utilizing the Fluent API. A valuable resource I have come across is an article on Fluent API by Scott Lilly, which explains how to create a smooth interface. The primary goal behind using Fluent API ...

Text Overlap Using the AlwaysVisibleControlExtender

I utilized the AlwaysVisibleControlExtender to fix a panel at a specific position. Now, I have this fixed panel containing text with multiple texts positioned underneath it. However, when I scroll, the texts under the panel overlap with the text inside the ...

Creating a GlobalVariable dynamically in Katalon during runtime using script mode

I am a beginner with the Katalon Studio tool and trying to dynamically add GlobalVariables by inputting both the variable name and value. I have found a piece of code that should help me achieve this, but I am struggling to understand it as it utilizes met ...

Struggling to interact with an HTML element using Selenium?

Currently struggling with getting Selenium to locate and click a button on a WebEx meeting page. Here is the Xpath for the elusive button: //*[@id="interstitial_join_btn"] However, every attempt I make using driver.find_element_by_xpath('//*[@id="in ...

What is the most efficient method for transferring rows from an SQL Database to JavaScript?

Recently, I've been exploring the dynamic features of HTML5 IndexedDB controlled by Javascript and how to sync it with an SQL Server database for offline access. The challenge I'm facing is determining the most efficient method to transfer data ...

Changing a fluid CSS selector into a fixed one

Trying to figure out how to use a dynamic CSS selector in my robot framework test. Is there a way to incorporate regex here? Here is the current selector I am using : #weekend11063281 > a:nth-child(1) Open to any suggestions on how to eliminate the d ...

Guidelines for forming a JSON variable using a SOAP Response

Currently using ASP.NET 4.0, I am faced with the task of sending a SOAP (XML) Response to a JSON variable in javascript on the page. The aim is to access the variable and its properties just like any other JSON variable would be accessed. The challenge lie ...

Having trouble running Selenium Chrome Driver on Pi Zero with error code -4?

Having trouble setting up a script on my new Pi Zero W after it was previously working on my Pi 3 B. It seems like the hardware may be the culprit as simply transferring the entire operating system to the new pi results in this issue, with no other changes ...

Execute tests on changing files using cypress.io

I'm currently experimenting with using Cypress to test a large Angular application that I've developed. What I want to achieve is to load an expectation file into my test and then run the test based on this expectation file. Despite trying diffe ...

Exploring the compatibility of IE9 with Selenium WebDriver

Hey everyone, I'm attempting to automate tasks in IE9 using Selenium WebDriver but keep encountering the following error in my Eclipse log. Can anyone offer some assistance? Internet Explorer is selected Started InternetExplorerDriver server (32-bit) ...

The Selenium FireFox webdriver is having trouble logging into Google accounts through Jenkins

For the past few days, I've been struggling with a major issue in my Java automated test that logs into Google Gmail. After integrating the test with Jenkins, it gets stuck when trying to enter the password. The user credentials are input correctly, a ...

Browsing through different sections of a website

Looking to utilize Selenium for web scraping purposes, specifically to extract links from a webpage. Encountering an issue with tabs on the page that switch between different subsections (Scene 1, Scene 2, etc.), hiding the relevant links in the process. D ...

Leveraging explicit waits to enable autocomplete functionality in Selenium

I'm in the process of updating this code to utilize explicit waits: class InputAutocompleteElement(InputElement): def __set__(self, obj, value): driver = obj.driver element = self.find_element(driver, self.locator) time.sleep ...

What could be the reason for the data returning as undefined?

I'm struggling to grasp why the data is returning as undefined. The information is there, but the value isn't displaying. Could it be that I overlooked something in the main function? Many thanks in advance to anyone who can help me with this per ...

Is there a way to activate anti-detect settings for Selenium Chromedriver on tabs initiated by the webdriver?

Within Selenium Chromedriver, I have implemented various features such as adding a proxy, using a fake user agent, disabling WebRTC through an extension, and spoofing Webgl with selenium-stealth. Additionally, I have also spoofed the time zone and language ...

Learn how to execute JavaScript code in Selenium without launching a web browser

I am currently using the Selenium API for web scraping on pages that contain JavaScript code. Is there a way to retrieve the code without having to open a web browser? I am still learning how to use this API Is this even feasible? ...

Where is the appropriate location to input parameters in Selenium testing?

What is the best approach for passing parameters? The code snippet below has been modified to focus on relevant pieces... I currently pass in login parameters directly within the [TestMethod], rather than within the LoginPage class object. Is this the co ...

Automating IE with Selenium in a scheduled task using RC

Looking to automate a task with Selenium-RC without the need for the user to be logged in. The ideal scenario involves running Selenium as a scheduled task, launching IE and executing the script seamlessly. Is it possible to simulate user interactions wit ...