0

I am using Anaconda2, Jupiter, and Chrome browser.

I am writing below code which is running successfully but now I want to click on button.

<a href="#" action="exportSelected" class="btn btn-default">
    <i class="glyphicon glyphicon-download"></i> Export
</a>

What should I write in Python to access this?

find_element_by_partial_link_text('btn btn-default').click()

It's giving an error.

3

2 Answers 2

5

"btn btn-default" is not a link text, but class names.

You can use one of below solutions:

  • Locate by exact link text:

    find_element_by_link_text('Export').click()
    
  • Locate by compound class name:

    find_element_by_css_selector('a.btn.btn-default').click()
    
  • Locate by action attribute

    find_element_by_css_selector('a[action="exportSelected"]').click()
    
Sign up to request clarification or add additional context in comments.

Comments

0

Thank you all replying me and suggesting pyhthon doc. appreciate it.

So i have used very simple lines to get my job done.

driver.find_element_by_xpath('copy your xpath'). which is very simple

driver.find_element_by_xpath('//[@id="app_content"]/div[2]/div/div/section/div/div[2]/div[1]/div[1]/div/div[2]/a[1]').click() driver.implicitly_wait(5) driver.find_element_by_xpath('//[@id="export_button"]').click()

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.