1

Need: Update fields on url & click button using Selenium (Screenshot of Webpage & HTML details below)

Issue: Returns an error as shown below

Error:

Exception in thread "main" org.openqa.selenium.ElementNotInteractableException: 
element not interactable

(Session info: chrome=78.0.3904.70)

Research: I referred to the following but was unable to fix it - Link1 Link2

Code: Based on the suggestions in other links have added Wait & also sleep, but still not working.

WebDriver driver = new ChromeDriver();
driver.get(url);
WebElement email = driver.findElement(By.xpath("//label[contains(text(),'User ID')]"));
WebElement password = driver.findElement(By.xpath("//label[contains(text(),'Password')]"));
new WebDriverWait(driver,20);
            try {
                Thread.sleep(10000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
email.sendKeys("myemail@gmail.com");

HTML & WebPage View: Link

Hope the issue faced is clear, await guidance.

iCoder
  • 1,406
  • 6
  • 16
  • 35
  • are you sure //label[contains(text(),'User ID')] element is present on UI after launching your url? – SeleniumUser Oct 30 '19 at 06:39
  • @DebanjanB no it does not. Before marking my query as duplicate if you had seen the error message you would've known. I had checked that link before posting. Anyway the answer by Ayaz (first option) resolves this issue. – iCoder Oct 30 '19 at 11:00

1 Answers1

1

Please try any of following xpath

//label[contains(text(),'User ID')]/following-sibling::input

//input[@placeholder='User ID']

your xpath is targeting label. You need to locate <input>

Ayaz
  • 249
  • 1
  • 2
  • 11
  • 1
    Not sure why moderator has marked it as duplicate. Anyone facing this issue use the first option suggested by Ayaz (i.e. /following-sibling), that works, not the 2nd one. – iCoder Oct 30 '19 at 08:03