2

I get the above error message on running this code:

using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.Firefox;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CV_Lib_Test
{
    class Program
    {
        static void Main(string[] args)
        {
            //Instantiate Firefox Driver
            var driver = new ChromeDriver();

            //Old Code - FirefoxDriver.Navigate().GoToUrl("https://www.cv-library.co.uk/candidate/login");
            driver.Navigate().GoToUrl("https://www.cv-library.co.uk/candidate/login");

            //Wait for web element to become visible
            System.Threading.Thread.Sleep(15000);

            //Enter User Name - Email Address
            var user = driver.FindElement(By.Id("cand-login-left"));
            user.SendKeys("EMAIL");

            //Enter Password - Account Pasword
            var pass = driver.FindElement(By.Id("cand-login-left"));
            pass.SendKeys("PASSWORD");

            //Click on Login button
            driver.FindElement(By.Id("cand-login-left")).Click();




        }
    }
}

My research revealed a few similar questions but they were not exactly helpful:

Does anyone know how I can implement the action class ( in the case of my code) using C#?

I strongly believe that that should fix the issue.

1 Answer 1

1

The error basically means that an element you try to interact with is not interactable - and, yes, if you look at what element is located by the cand-login-left id, you would see that this is a div element which cannot be focused to send keys to:

<div id="cand-login-left">...</div>

Locate email, password fields and "login" button using appropriate locators:

// Enter User Name - Email Address
var user = driver.FindElement(By.Name("email"));
user.SendKeys("YOUR EMAIL HERE");

// Enter Password - Account Password
var pass = driver.FindElement(By.Name("password"));
pass.SendKeys("YOUR PASSWORD HERE");

// Click on Login button
driver.FindElement(By.CssSelector("input[title=Login]")).Click();
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.