Need help in extracting the case id, would be great help
<div ><h4 id="note-label-CreateCaseUploadDoc:Display_Process_Combination1:RequestID" >A new request is created successfully</h4><p id="
">412312513</p></div></div>
Need to extract 412312513
out of this
CodePudding user response:
You can use following-sibling
to get text node value from p tag as follow:
//*[@]/following-sibling::p
OR
Using css selector
.note.note-info h4 p
Example with selenium
txt = WebDriverWait(driver, 20).until(EC.visibility_of_element_located((By.XPATH, '//*[@]/following-sibling::p'))).text
OR selenium with css selector
txt = WebDriverWait(driver, 20).until(EC.visibility_of_element_located((By.CSS_SELECTOR, '.note.note-info h4 p'))).text
#imports
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC