Html – I want to only extract the content of li without the contents of span in Python Selenium WebDriver
So here is the sample html doc: <div id="div1"> <ul class="lists"> <li class="listItem1"> List content <span class="span1">span text</span> </li> </ul> </div> I only want to extract "List content" If I do this: elementList = driver.find_element(By.XPATH, "/div/ul/li") elementList.text I get :…