Unable to click on an element through Selenium Python









up vote
1
down vote

favorite












On google flights page, I want to click on the right arrow (increase number of days) at the bottom of the dialog (attached image). The second click gives me selenium.common.exceptions.TimeoutException error.



Here is my code:



url = 'https://www.google.fr/flights'
driver.get(url)
elem1 = driver.find_elements_by_xpath("//span[@class='gws-flights-form__date-content']")[0]
elem1.click()
a = wait.until(EC.visibility_of_element_located((By.XPATH, "//<span[@class='gws-flights-dialog__calendar-duration-flipper-increase']")))
a.click()


Screenshot



enter image description here










share|improve this question



























    up vote
    1
    down vote

    favorite












    On google flights page, I want to click on the right arrow (increase number of days) at the bottom of the dialog (attached image). The second click gives me selenium.common.exceptions.TimeoutException error.



    Here is my code:



    url = 'https://www.google.fr/flights'
    driver.get(url)
    elem1 = driver.find_elements_by_xpath("//span[@class='gws-flights-form__date-content']")[0]
    elem1.click()
    a = wait.until(EC.visibility_of_element_located((By.XPATH, "//<span[@class='gws-flights-dialog__calendar-duration-flipper-increase']")))
    a.click()


    Screenshot



    enter image description here










    share|improve this question

























      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      On google flights page, I want to click on the right arrow (increase number of days) at the bottom of the dialog (attached image). The second click gives me selenium.common.exceptions.TimeoutException error.



      Here is my code:



      url = 'https://www.google.fr/flights'
      driver.get(url)
      elem1 = driver.find_elements_by_xpath("//span[@class='gws-flights-form__date-content']")[0]
      elem1.click()
      a = wait.until(EC.visibility_of_element_located((By.XPATH, "//<span[@class='gws-flights-dialog__calendar-duration-flipper-increase']")))
      a.click()


      Screenshot



      enter image description here










      share|improve this question















      On google flights page, I want to click on the right arrow (increase number of days) at the bottom of the dialog (attached image). The second click gives me selenium.common.exceptions.TimeoutException error.



      Here is my code:



      url = 'https://www.google.fr/flights'
      driver.get(url)
      elem1 = driver.find_elements_by_xpath("//span[@class='gws-flights-form__date-content']")[0]
      elem1.click()
      a = wait.until(EC.visibility_of_element_located((By.XPATH, "//<span[@class='gws-flights-dialog__calendar-duration-flipper-increase']")))
      a.click()


      Screenshot



      enter image description here







      selenium selenium-webdriver xpath css-selectors webdriverwait






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 9 at 21:06









      DebanjanB

      35.4k73271




      35.4k73271










      asked Nov 9 at 20:08









      PittLee

      84




      84






















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote



          accepted










          To click on the right arrow to increase number of days at the bottom of the dialog instead of using visibility_of_element_located() method you need to use element_to_be_clickable() method and you can use either of the following solutions:




          • CSS_SELECTOR:



            WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "div.gws-flights-form__departure-input[data-flt-ve='departure_date'] div.gws-flights-form__next"))).click()



          • XPATH:



            WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//div[@data-flt-ve='departure_date' and contains(@class,'gws-flights-form__departure-input')]//div[@class='gws-flights-form__next']"))).click()






          share|improve this answer




















          • It still gives me selenium.common.exceptions.TimeoutException wait.until(EC.element_to_be_clickable((By.XPATH, "//div[@data-flt-ve='departure_date' and contains(@class,'gws-flights-form__departure-input')]/div[@class='gws-flights-form__next']"))).click()
            – PittLee
            Nov 10 at 3:09











          • @PittLee How about the CSS-SELECTOR?
            – DebanjanB
            Nov 10 at 19:50










          • I got this error: selenium.common.exceptions.WebDriverException: Message: unknown error: Element <div aria-hidden="true" role="presentation" tabindex="-1" jstcache="5760" jsaction="jsl._" class="gws-flights-form__next" jsan="7.gws-flights-form__next,0.aria-hidden,0.role,0.tabindex,22.jsaction"></div> is not clickable at point (903, 156). Other element would receive the click: <div class="gws-flights__glass-pane" id="flt-glass" role="presentation" tabindex="-1" jsaction="jsl._" jstcache="5646" style="display: block;"></div>
            – PittLee
            Nov 11 at 0:22






          • 1




            The issue seems related to Chrome driver. I tried your solution in firefox, and it worked. Really appreciate your help!
            – PittLee
            Nov 11 at 14:53











          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',
          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%2f53232652%2funable-to-click-on-an-element-through-selenium-python%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          0
          down vote



          accepted










          To click on the right arrow to increase number of days at the bottom of the dialog instead of using visibility_of_element_located() method you need to use element_to_be_clickable() method and you can use either of the following solutions:




          • CSS_SELECTOR:



            WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "div.gws-flights-form__departure-input[data-flt-ve='departure_date'] div.gws-flights-form__next"))).click()



          • XPATH:



            WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//div[@data-flt-ve='departure_date' and contains(@class,'gws-flights-form__departure-input')]//div[@class='gws-flights-form__next']"))).click()






          share|improve this answer




















          • It still gives me selenium.common.exceptions.TimeoutException wait.until(EC.element_to_be_clickable((By.XPATH, "//div[@data-flt-ve='departure_date' and contains(@class,'gws-flights-form__departure-input')]/div[@class='gws-flights-form__next']"))).click()
            – PittLee
            Nov 10 at 3:09











          • @PittLee How about the CSS-SELECTOR?
            – DebanjanB
            Nov 10 at 19:50










          • I got this error: selenium.common.exceptions.WebDriverException: Message: unknown error: Element <div aria-hidden="true" role="presentation" tabindex="-1" jstcache="5760" jsaction="jsl._" class="gws-flights-form__next" jsan="7.gws-flights-form__next,0.aria-hidden,0.role,0.tabindex,22.jsaction"></div> is not clickable at point (903, 156). Other element would receive the click: <div class="gws-flights__glass-pane" id="flt-glass" role="presentation" tabindex="-1" jsaction="jsl._" jstcache="5646" style="display: block;"></div>
            – PittLee
            Nov 11 at 0:22






          • 1




            The issue seems related to Chrome driver. I tried your solution in firefox, and it worked. Really appreciate your help!
            – PittLee
            Nov 11 at 14:53















          up vote
          0
          down vote



          accepted










          To click on the right arrow to increase number of days at the bottom of the dialog instead of using visibility_of_element_located() method you need to use element_to_be_clickable() method and you can use either of the following solutions:




          • CSS_SELECTOR:



            WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "div.gws-flights-form__departure-input[data-flt-ve='departure_date'] div.gws-flights-form__next"))).click()



          • XPATH:



            WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//div[@data-flt-ve='departure_date' and contains(@class,'gws-flights-form__departure-input')]//div[@class='gws-flights-form__next']"))).click()






          share|improve this answer




















          • It still gives me selenium.common.exceptions.TimeoutException wait.until(EC.element_to_be_clickable((By.XPATH, "//div[@data-flt-ve='departure_date' and contains(@class,'gws-flights-form__departure-input')]/div[@class='gws-flights-form__next']"))).click()
            – PittLee
            Nov 10 at 3:09











          • @PittLee How about the CSS-SELECTOR?
            – DebanjanB
            Nov 10 at 19:50










          • I got this error: selenium.common.exceptions.WebDriverException: Message: unknown error: Element <div aria-hidden="true" role="presentation" tabindex="-1" jstcache="5760" jsaction="jsl._" class="gws-flights-form__next" jsan="7.gws-flights-form__next,0.aria-hidden,0.role,0.tabindex,22.jsaction"></div> is not clickable at point (903, 156). Other element would receive the click: <div class="gws-flights__glass-pane" id="flt-glass" role="presentation" tabindex="-1" jsaction="jsl._" jstcache="5646" style="display: block;"></div>
            – PittLee
            Nov 11 at 0:22






          • 1




            The issue seems related to Chrome driver. I tried your solution in firefox, and it worked. Really appreciate your help!
            – PittLee
            Nov 11 at 14:53













          up vote
          0
          down vote



          accepted







          up vote
          0
          down vote



          accepted






          To click on the right arrow to increase number of days at the bottom of the dialog instead of using visibility_of_element_located() method you need to use element_to_be_clickable() method and you can use either of the following solutions:




          • CSS_SELECTOR:



            WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "div.gws-flights-form__departure-input[data-flt-ve='departure_date'] div.gws-flights-form__next"))).click()



          • XPATH:



            WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//div[@data-flt-ve='departure_date' and contains(@class,'gws-flights-form__departure-input')]//div[@class='gws-flights-form__next']"))).click()






          share|improve this answer












          To click on the right arrow to increase number of days at the bottom of the dialog instead of using visibility_of_element_located() method you need to use element_to_be_clickable() method and you can use either of the following solutions:




          • CSS_SELECTOR:



            WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "div.gws-flights-form__departure-input[data-flt-ve='departure_date'] div.gws-flights-form__next"))).click()



          • XPATH:



            WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//div[@data-flt-ve='departure_date' and contains(@class,'gws-flights-form__departure-input')]//div[@class='gws-flights-form__next']"))).click()







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 9 at 21:07









          DebanjanB

          35.4k73271




          35.4k73271











          • It still gives me selenium.common.exceptions.TimeoutException wait.until(EC.element_to_be_clickable((By.XPATH, "//div[@data-flt-ve='departure_date' and contains(@class,'gws-flights-form__departure-input')]/div[@class='gws-flights-form__next']"))).click()
            – PittLee
            Nov 10 at 3:09











          • @PittLee How about the CSS-SELECTOR?
            – DebanjanB
            Nov 10 at 19:50










          • I got this error: selenium.common.exceptions.WebDriverException: Message: unknown error: Element <div aria-hidden="true" role="presentation" tabindex="-1" jstcache="5760" jsaction="jsl._" class="gws-flights-form__next" jsan="7.gws-flights-form__next,0.aria-hidden,0.role,0.tabindex,22.jsaction"></div> is not clickable at point (903, 156). Other element would receive the click: <div class="gws-flights__glass-pane" id="flt-glass" role="presentation" tabindex="-1" jsaction="jsl._" jstcache="5646" style="display: block;"></div>
            – PittLee
            Nov 11 at 0:22






          • 1




            The issue seems related to Chrome driver. I tried your solution in firefox, and it worked. Really appreciate your help!
            – PittLee
            Nov 11 at 14:53

















          • It still gives me selenium.common.exceptions.TimeoutException wait.until(EC.element_to_be_clickable((By.XPATH, "//div[@data-flt-ve='departure_date' and contains(@class,'gws-flights-form__departure-input')]/div[@class='gws-flights-form__next']"))).click()
            – PittLee
            Nov 10 at 3:09











          • @PittLee How about the CSS-SELECTOR?
            – DebanjanB
            Nov 10 at 19:50










          • I got this error: selenium.common.exceptions.WebDriverException: Message: unknown error: Element <div aria-hidden="true" role="presentation" tabindex="-1" jstcache="5760" jsaction="jsl._" class="gws-flights-form__next" jsan="7.gws-flights-form__next,0.aria-hidden,0.role,0.tabindex,22.jsaction"></div> is not clickable at point (903, 156). Other element would receive the click: <div class="gws-flights__glass-pane" id="flt-glass" role="presentation" tabindex="-1" jsaction="jsl._" jstcache="5646" style="display: block;"></div>
            – PittLee
            Nov 11 at 0:22






          • 1




            The issue seems related to Chrome driver. I tried your solution in firefox, and it worked. Really appreciate your help!
            – PittLee
            Nov 11 at 14:53
















          It still gives me selenium.common.exceptions.TimeoutException wait.until(EC.element_to_be_clickable((By.XPATH, "//div[@data-flt-ve='departure_date' and contains(@class,'gws-flights-form__departure-input')]/div[@class='gws-flights-form__next']"))).click()
          – PittLee
          Nov 10 at 3:09





          It still gives me selenium.common.exceptions.TimeoutException wait.until(EC.element_to_be_clickable((By.XPATH, "//div[@data-flt-ve='departure_date' and contains(@class,'gws-flights-form__departure-input')]/div[@class='gws-flights-form__next']"))).click()
          – PittLee
          Nov 10 at 3:09













          @PittLee How about the CSS-SELECTOR?
          – DebanjanB
          Nov 10 at 19:50




          @PittLee How about the CSS-SELECTOR?
          – DebanjanB
          Nov 10 at 19:50












          I got this error: selenium.common.exceptions.WebDriverException: Message: unknown error: Element <div aria-hidden="true" role="presentation" tabindex="-1" jstcache="5760" jsaction="jsl._" class="gws-flights-form__next" jsan="7.gws-flights-form__next,0.aria-hidden,0.role,0.tabindex,22.jsaction"></div> is not clickable at point (903, 156). Other element would receive the click: <div class="gws-flights__glass-pane" id="flt-glass" role="presentation" tabindex="-1" jsaction="jsl._" jstcache="5646" style="display: block;"></div>
          – PittLee
          Nov 11 at 0:22




          I got this error: selenium.common.exceptions.WebDriverException: Message: unknown error: Element <div aria-hidden="true" role="presentation" tabindex="-1" jstcache="5760" jsaction="jsl._" class="gws-flights-form__next" jsan="7.gws-flights-form__next,0.aria-hidden,0.role,0.tabindex,22.jsaction"></div> is not clickable at point (903, 156). Other element would receive the click: <div class="gws-flights__glass-pane" id="flt-glass" role="presentation" tabindex="-1" jsaction="jsl._" jstcache="5646" style="display: block;"></div>
          – PittLee
          Nov 11 at 0:22




          1




          1




          The issue seems related to Chrome driver. I tried your solution in firefox, and it worked. Really appreciate your help!
          – PittLee
          Nov 11 at 14:53





          The issue seems related to Chrome driver. I tried your solution in firefox, and it worked. Really appreciate your help!
          – PittLee
          Nov 11 at 14:53


















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53232652%2funable-to-click-on-an-element-through-selenium-python%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

          How to how show current date and time by default on contact form 7 in WordPress without taking input from user in datetimepicker

          Syphilis

          Darth Vader #20