0

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();
Amit
  • 19,780
  • 6
  • 46
  • 54
tummalsr
  • 21
  • 8
  • Try `driver.findElement(By.xpath("//*[@id=\"monitorForm:enforcementType_panel\"]/div[2]/ul/li[112]/label[contains(text()," + symptom +"]")).click();` – supputuri Jul 29 '19 at 20:54
  • it is throwing null – tummalsr Jul 29 '19 at 21:03
  • are you sure the `symptom` is storing the value? Can you make sure the xpath is working in the browser devtool refer [here](https://stackoverflow.com/questions/55870609/is-there-a-way-to-learn-xpath-without-using-firebug-or-xpath-as-firefox-is-not-s/55870909#55870909) if you need help on that. – supputuri Jul 29 '19 at 21:45

0 Answers0