0

This is the code:

 driver.get(url).then(function(){
         txtFnn = driver.findElement(webdriver.By.xpath(xpath));
         return txtFnn;
    }).then(function(){
           txtFnn.sendkeys("12345678");
    })

Error:

TypeError: txtFnn.sendkeys is not a function

HaveNoDisplayName
  • 8,291
  • 106
  • 37
  • 47

2 Answers2

0

I'm assuming a lot because you don't supply much info, but from the code, I assume that driver.findElement returns a Promise ... so

driver.get(url).then(function(){
         return driver.findElement(webdriver.By.xpath(xpath));
    }).then(function(txtFnn){
           txtFnn.sendkeys("12345678");
    })

Does that work? If so, I'll explain where you went wrong in the first place, but if not, there's no point wasting time on explaining something comes from my assumptions

Jaromanda X
  • 53,868
  • 5
  • 73
  • 87
0

your code can be simplified as:

driver.get(url);
txtFnn = driver.findElement(webdriver.By.xpath(xpath));
txtFnn.sendkeys("12345678");

can you try this and tell me if you are still getting the error? are you sure that the xpath is correct?

mido
  • 24,198
  • 15
  • 92
  • 117