Protractor - Element not found



  • I'm new to protractor and trying write a script. But every time I try to locate an element "The Element not found" error is coming.

    These are the error messages I'm getting:

         Failed: No element found using locator: By(xpath, //*[@id="firstName"])
         Failed: No element found using locator: By(css selector,*[id="firstName"])
    ```
    

    I have tried below codes. But everything is failing.

        element(by.xpath('//*[@id="firstName"]')).sendKeys('Mátyás');
    ```
    
        element(by.id('firstName')).sendKeys('Mátyás');
    ```
    
    
        browser.findElement(by.id('firstName')).sendKeys('Mátyás');
    ```
    
    

    This is the element I'm trying to access.

        
    ```
    
    

    What am I doing wrong?



  • Verify the element is present inside a Frame. If so then switch into the frame first and access the element.

    browser.switchTo().frame(id or webelement);
    


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2