troubleshooting Question

selenium python question

Avatar of Hiro 714
Hiro 714 asked on
3 Comments1 Solution9 ViewsLast Modified:
I want to select the button and click.
Would you advise?
<a ui-sref="physical-item-view({id:})" class="w-btn w-btn-action" ng-class="{'disabled' : item.isConsumable}" uib-tooltip="Details" tooltip-placement="top-right" tooltip-append-to-body="true" href="#/physical-item/1002152546"> <i class="fa fa-eye"></i> </a>

Open in new window

Please correct the following code.
Python code
elem_login_btn = browser.find_element_by_class_name('w-btn wbtn-action')

Open in new window

When I run, this message comes:
Jupyter Notebook Error Message
NoSuchElementException                    Traceback (most recent call last)
<ipython-input-19-920f716fbe43> in <module>
----> 1 elem_login_btn = browser.find_element_by_class_name('w-btn wbtn-action')

~\AppData\Roaming\Python\Python38\site-packages\selenium\webdriver\remote\ in find_element_by_class_name(self, name)
    562             element = driver.find_element_by_class_name('foo')
    563         """
--> 564         return self.find_element(by=By.CLASS_NAME, value=name)
    566     def find_elements_by_class_name(self, name):

~\AppData\Roaming\Python\Python38\site-packages\selenium\webdriver\remote\ in find_element(self, by, value)
    974                 by = By.CSS_SELECTOR
    975                 value = '[name="%s"]' % value
--> 976         return self.execute(Command.FIND_ELEMENT, {
    977             'using': by,
    978             'value': value})['value'] 
~\AppData\Roaming\Python\Python38\site-packages\selenium\webdriver\remote\ in execute(self, driver_command, params)
    319         response = self.command_executor.execute(driver_command, params)
    320         if response:
--> 321             self.error_handler.check_response(response)
    322             response['value'] = self._unwrap_value(
    323                 response.get('value', None)) 
~\AppData\Roaming\Python\Python38\site-packages\selenium\webdriver\remote\ in check_response(self, response)
    240                 alert_text = value['alert'].get('text')
    241             raise exception_class(message, screen, stacktrace, alert_text)
--> 242         raise exception_class(message, screen, stacktrace)
    244     def _value_or_default(self, obj, key, default):

NoSuchElementException: Message: Unable to locate element: .w-btn wbtn-action

Open in new window

NorieSenior Associate
Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros