how to get the value for dynamic label in selenium

234 Views Asked by At

The label value changes dynamically based on the test criteria.Here i send a symptom value as 'Signal. But, i actually wanted to send what ever the value is on Symptom . I tried the below code but it doesn't work . Please suggest

driver.findElement(By.xpath("//*[@id=\"monitorForm:enforcementType_panel\"]/div[2]/ul/li[112]/label[contains(text(),symptom]")).click();

String symptom = data.get("Symptom");
getElement("symptomTextBoxClick_xpath").sendKeys(symptom);
driver.findElement(By.xpath("//*[@id=\"monitorForm:enforcementType_panel\"]/div[2]/ul/li[112]/label[.='Signal']")).click();
0

There are 0 best solutions below