My button looks like this:
<button type="button" data-toggle="modal" data-target="#modal-order-export" data-backdrop="false" class="btn btn-default btn-sm">
<i class="fa fa-file-excel-o"></i> 엑셀 저장
</button>`
How can I click this object via selenium to automate some work? I tried:
driver.find_element_by_link_text('엑셀 저장').click()
You could take its xpath by right-clicking the element in developer tools and choosing copy. Then just find the element using xpath.
The WebElement
which you are trying to search/find is within <button>
tag hence find_element_by_link_text
may not work. We will be using an xpath
to locate the WebElement
as follows:
driver.find_element_by_xpath("//button[@class='btn btn-default btn-sm']/i[@class='fa fa-file-excel-o']").click()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.