I've seen this error everywhere, but none of the solutions have seemed to work.

This is my code:

contpayment = driver.find_element_by_class_name('nsg-bg--nike-orange')


Python/selenium finds this element perfectly, but when trying to click it throws an eception:

"ElementNotVisibleException: Message: element not visible"

I've even tried adding a time.sleep(10) to ensure the page has completely loaded, but it still returns the same exception... Even finding by XPath and id gives the same.

Here is the HTML Code:

<button type="button" id="shippingSubmit" name="shipSubmit" class="visible-
xs-block  hidden-sm nsg-button--thin nsg-bg--nike-orange uppercase change-
section-button ng-binding" ng-click="sendForm('Payment')">Continue to Payment </button>

Any help would be appreciated !

  • Please share the html code. May 24, 2018 at 7:03
  • html code has been added
    – 123ang
    May 24, 2018 at 7:06
  • what if you use find_elements_by_class_name instead of find_element_by_class_name? How many items are returned? That might happen that you have both visible and invisible items matching locator. And the invisible one goes prior to visible.
    – Alexey R.
    May 24, 2018 at 16:22

3 Answers 3


1.Use following XPath Locators:

//button[contains(@id,'shippingSubmit') and (@name,'shipSubmit')];


//button[contains(@id,'shippingSubmit') and starts-with(@class,'visible-xs-block')];


//button[contains(.,'Continue to Payment')];

2. Add Explicit Wait before clicking to the particular button.

contpayment = WebDriverWait(driver, 10).until(
        EC.presence_of_element_located((By.XPATH, "//button[contains(.,'Continue to Payment')]")))

  • updated code plz check. May 24, 2018 at 8:23
  • if one not works, Try changing all other XPath. May 24, 2018 at 8:26
  • Does it work's for you? May 26, 2018 at 10:40

Use WebDriverWait and visibility_of_element_located to locate the element until the element is visible.

from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

element = WebDriverWait(driver, 20).until(EC.visibility_of_element_located((By.ID, "shippingSubmit")))    


In case, waiting for the element for visibility is not working, try execute_script.

driver.execute_script("$(arguments[0]).click();", element)
  • That seemed to work however, it looks like the button is like permanently invisible because I just got a timeout exception... weird
    – 123ang
    May 24, 2018 at 7:15
  • See the alternative way.
    – Shahid
    May 24, 2018 at 7:46
  • still getting timeout :/
    – 123ang
    May 24, 2018 at 7:55

Use this below XPath this will work.

driver.findElementByXpath("//button[contains(text(),'Continue to Payment')]");

This xpath will locate the button directly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.