I am trying to get the information in value=" "
from this code.
As long as the class has the word orange in it, I want to store the value.
Expected result in this case is storing value "JKK-LKK" in a variable.
<input type="text" readonly="" class="form-control nl-forms-wp-orange" value="JKK-LKK" style="cursor: pointer; border-left-style: none;>
I have tried using
text = driver.find_elements_by_xpath("//*[contains(text(), 'nl-forms-wp-orange')]").get_attribute("value"))
But I get:
AttributeError: 'list' Object has no attribute 'get_attribute'.
I've also tried getText("value")
but I get is not a valid Xpath expression.
If I try only using
driver.find_elements_by_xpath("//*[contains(text(), 'nl-forms-wp-orange')]")
The list becomes empty. So I feel like I might be missing some few other key pieces. What might I be doing wrong?