I just want to say that I am new to Python/Selenium and I’ve been googling and wracking my head for hours now.
I am trying to extract a value from an element from the website we use for creating tickets at work. The thing is, the element with the ticket number has no ID and I cannot seem to be able to single it out using its other attributes.
The HTML for the elements is as follows:
<span class="custom-field__value ng-binding ng-scope" ng-if="!$parent.editMode && data.value" tooltip="" ng-bind-html="((status.isCollapsed) ? (data.value | securelinky : '_blank')) || ('customField.label.noValue' | i18n)">INC22963815</span>
So, I want to get the INC22963815 from the element.
I tried with
ticket = driver.find_element_by_class("custom-field__value ng-binding ng-scope")
ticket = driver.find_elements_by_class("custom-field__value ng-binding ng-scope") for number in ticket: print(number.get_attribute("innerText"))
but I get nothing.
But when I tried with
ticket = driver.find_elements_by_tag_name("SPAN") for number in ticket: print(number.get_attribute("innerText"))
I found the text I am looking for, but it also outputs almost everything else on the page, so it is not very useful.
So now I am resorting to asking the question myself. I need help just to single out that one element. Thank you in advance.