Sebastian Nielsen
Sebastian Nielsen

Reputation: 4199

python selenium - Why cant I click this?

https://gyazo.com/9887635aa04d723758ba17b3413f72e1 - the html

the one named class="radio inline bundle-cta" is the one i want.

<label class="radio inline bundle-cta">
            <input data-bind="checked: activeBundle" id="BundleType" name="BundleType" type="radio" value="Default">
            Nej tak, jeg vælger en basisannonce uden tilvalg
                <span class="uneditable-input price">Kr. <span data-price="0">0</span>,-</span>

            <span class="bundle-cta-button">Vælg basisannonce</span>
        </label>

error msg, when trying to click it:

Element is not clickable at point (604, 698). Other element would receive the click: <p style="line-height: 20px; margin: 0px 40px 0px 15px; padding: 0px;">...</p>
  (Session info: chrome=54.0.2840.71)
  (Driver info: chromedriver=2.25.426923 (0390b88869384d6eb0d5d09729679f934aab9eed),platform=Windows NT 10.0.14393 x86_64)

code I used to try to click it:

element = WebDriverWait(driver, 10).until(
EC.presence_of_element_located((By.class, "bundle-cta-button"))

# vælg gratis pakke
browser.find_element_by_class_name('bundle-cta-button').click()
sleep(0.75)
browser.find_element_by_xpath('//*[@id="content"]/div[2]/div/div/form/div/button').click()

Upvotes: 0

Views: 107

Answers (1)

AntonioRB
AntonioRB

Reputation: 159

Try to change spaces into dots, and find by CSS_selector like below:

browser.find_element_by_css_selector("radio.inline.bundle-cta").click()

Upvotes: 1

Related Questions