Selenium displays NoSuchElementException despite the element being there












-3















So I made a short bit of selenium code, it isn't letting me select elements though! I do not understand. I try copy and pasting examples and none work because of this.



It says: NoSuchElementException: Unable to locate element #login-input



Here is my java code:



WebDriver driver = new FirefoxDriver();
driver.manage().timeouts().implicitlyWait( 10, TimeUnit.SECONDS );
driver.get( "https://www.ticketmaster.com/review" );
WebElement inputElement = driver.findElement( By.id( "login-input" ) );









share|improve this question

























  • Possible duplicate of Find elements inside forms and iframe using Java and Selenium WebDriver

    – JeffC
    Nov 24 '18 at 2:48
















-3















So I made a short bit of selenium code, it isn't letting me select elements though! I do not understand. I try copy and pasting examples and none work because of this.



It says: NoSuchElementException: Unable to locate element #login-input



Here is my java code:



WebDriver driver = new FirefoxDriver();
driver.manage().timeouts().implicitlyWait( 10, TimeUnit.SECONDS );
driver.get( "https://www.ticketmaster.com/review" );
WebElement inputElement = driver.findElement( By.id( "login-input" ) );









share|improve this question

























  • Possible duplicate of Find elements inside forms and iframe using Java and Selenium WebDriver

    – JeffC
    Nov 24 '18 at 2:48














-3












-3








-3








So I made a short bit of selenium code, it isn't letting me select elements though! I do not understand. I try copy and pasting examples and none work because of this.



It says: NoSuchElementException: Unable to locate element #login-input



Here is my java code:



WebDriver driver = new FirefoxDriver();
driver.manage().timeouts().implicitlyWait( 10, TimeUnit.SECONDS );
driver.get( "https://www.ticketmaster.com/review" );
WebElement inputElement = driver.findElement( By.id( "login-input" ) );









share|improve this question
















So I made a short bit of selenium code, it isn't letting me select elements though! I do not understand. I try copy and pasting examples and none work because of this.



It says: NoSuchElementException: Unable to locate element #login-input



Here is my java code:



WebDriver driver = new FirefoxDriver();
driver.manage().timeouts().implicitlyWait( 10, TimeUnit.SECONDS );
driver.get( "https://www.ticketmaster.com/review" );
WebElement inputElement = driver.findElement( By.id( "login-input" ) );






java selenium selenium-webdriver iframe webdriverwait






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 24 '18 at 7:21









DebanjanB

40.6k73878




40.6k73878










asked Nov 24 '18 at 2:28









FX_NINJAFX_NINJA

985




985













  • Possible duplicate of Find elements inside forms and iframe using Java and Selenium WebDriver

    – JeffC
    Nov 24 '18 at 2:48



















  • Possible duplicate of Find elements inside forms and iframe using Java and Selenium WebDriver

    – JeffC
    Nov 24 '18 at 2:48

















Possible duplicate of Find elements inside forms and iframe using Java and Selenium WebDriver

– JeffC
Nov 24 '18 at 2:48





Possible duplicate of Find elements inside forms and iframe using Java and Selenium WebDriver

– JeffC
Nov 24 '18 at 2:48












2 Answers
2






active

oldest

votes


















1














Your login form is inside the iframe. Switch your driver first, try the bellow code :



WebDriver driver = new FirefoxDriver();
driver.manage().timeouts().implicitlyWait( 10, TimeUnit.SECONDS );
driver.get( "https://www.ticketmaster.com/review" );

driver.switchTo().frame("loginFrame");
WebElement inputElement = driver.findElement( By.id( "login-input" ) );
inputElement.sendKeys("test");





share|improve this answer































    1














    The username and password fields are within an iframe, so you have to:




    • Induce WebDriverWait for the desired frame to be available and switch to it.

    • Induce WebDriverWait for the desired element to be clickable.


    • You can use the following solution:



      WebDriver driver = new FirefoxDriver();
      driver.get( "https://www.ticketmaster.com/review" );
      new WebDriverWait(driver, 10).until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(By.cssSelector("iframe#loginFrame")));
      new WebDriverWait(driver, 20).until(ExpectedConditions.elementToBeClickable(By.cssSelector("label[for='login-input']"))).sendKeys("FX_NINJA");







    share|improve this answer























      Your Answer






      StackExchange.ifUsing("editor", function () {
      StackExchange.using("externalEditor", function () {
      StackExchange.using("snippets", function () {
      StackExchange.snippets.init();
      });
      });
      }, "code-snippets");

      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "1"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53454683%2fselenium-displays-nosuchelementexception-despite-the-element-being-there%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      1














      Your login form is inside the iframe. Switch your driver first, try the bellow code :



      WebDriver driver = new FirefoxDriver();
      driver.manage().timeouts().implicitlyWait( 10, TimeUnit.SECONDS );
      driver.get( "https://www.ticketmaster.com/review" );

      driver.switchTo().frame("loginFrame");
      WebElement inputElement = driver.findElement( By.id( "login-input" ) );
      inputElement.sendKeys("test");





      share|improve this answer




























        1














        Your login form is inside the iframe. Switch your driver first, try the bellow code :



        WebDriver driver = new FirefoxDriver();
        driver.manage().timeouts().implicitlyWait( 10, TimeUnit.SECONDS );
        driver.get( "https://www.ticketmaster.com/review" );

        driver.switchTo().frame("loginFrame");
        WebElement inputElement = driver.findElement( By.id( "login-input" ) );
        inputElement.sendKeys("test");





        share|improve this answer


























          1












          1








          1







          Your login form is inside the iframe. Switch your driver first, try the bellow code :



          WebDriver driver = new FirefoxDriver();
          driver.manage().timeouts().implicitlyWait( 10, TimeUnit.SECONDS );
          driver.get( "https://www.ticketmaster.com/review" );

          driver.switchTo().frame("loginFrame");
          WebElement inputElement = driver.findElement( By.id( "login-input" ) );
          inputElement.sendKeys("test");





          share|improve this answer













          Your login form is inside the iframe. Switch your driver first, try the bellow code :



          WebDriver driver = new FirefoxDriver();
          driver.manage().timeouts().implicitlyWait( 10, TimeUnit.SECONDS );
          driver.get( "https://www.ticketmaster.com/review" );

          driver.switchTo().frame("loginFrame");
          WebElement inputElement = driver.findElement( By.id( "login-input" ) );
          inputElement.sendKeys("test");






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 24 '18 at 6:56









          FrianFrian

          858




          858

























              1














              The username and password fields are within an iframe, so you have to:




              • Induce WebDriverWait for the desired frame to be available and switch to it.

              • Induce WebDriverWait for the desired element to be clickable.


              • You can use the following solution:



                WebDriver driver = new FirefoxDriver();
                driver.get( "https://www.ticketmaster.com/review" );
                new WebDriverWait(driver, 10).until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(By.cssSelector("iframe#loginFrame")));
                new WebDriverWait(driver, 20).until(ExpectedConditions.elementToBeClickable(By.cssSelector("label[for='login-input']"))).sendKeys("FX_NINJA");







              share|improve this answer




























                1














                The username and password fields are within an iframe, so you have to:




                • Induce WebDriverWait for the desired frame to be available and switch to it.

                • Induce WebDriverWait for the desired element to be clickable.


                • You can use the following solution:



                  WebDriver driver = new FirefoxDriver();
                  driver.get( "https://www.ticketmaster.com/review" );
                  new WebDriverWait(driver, 10).until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(By.cssSelector("iframe#loginFrame")));
                  new WebDriverWait(driver, 20).until(ExpectedConditions.elementToBeClickable(By.cssSelector("label[for='login-input']"))).sendKeys("FX_NINJA");







                share|improve this answer


























                  1












                  1








                  1







                  The username and password fields are within an iframe, so you have to:




                  • Induce WebDriverWait for the desired frame to be available and switch to it.

                  • Induce WebDriverWait for the desired element to be clickable.


                  • You can use the following solution:



                    WebDriver driver = new FirefoxDriver();
                    driver.get( "https://www.ticketmaster.com/review" );
                    new WebDriverWait(driver, 10).until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(By.cssSelector("iframe#loginFrame")));
                    new WebDriverWait(driver, 20).until(ExpectedConditions.elementToBeClickable(By.cssSelector("label[for='login-input']"))).sendKeys("FX_NINJA");







                  share|improve this answer













                  The username and password fields are within an iframe, so you have to:




                  • Induce WebDriverWait for the desired frame to be available and switch to it.

                  • Induce WebDriverWait for the desired element to be clickable.


                  • You can use the following solution:



                    WebDriver driver = new FirefoxDriver();
                    driver.get( "https://www.ticketmaster.com/review" );
                    new WebDriverWait(driver, 10).until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(By.cssSelector("iframe#loginFrame")));
                    new WebDriverWait(driver, 20).until(ExpectedConditions.elementToBeClickable(By.cssSelector("label[for='login-input']"))).sendKeys("FX_NINJA");








                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 24 '18 at 7:22









                  DebanjanBDebanjanB

                  40.6k73878




                  40.6k73878






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Stack Overflow!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53454683%2fselenium-displays-nosuchelementexception-despite-the-element-being-there%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Berounka

                      Fiat S.p.A.

                      Type 'String' is not a subtype of type 'int' of 'index'