I have tried using Webelement to store value but facing Error like : [Below is the image of which I want to get value that is K1]
I am Not Getting value through Weblelement as It is displaying Error as
org.openqa.selenium.InvalidSelectorException: The given selector //div[2]/label/strong/following-sibling::text()
is either invalid or does not result in a WebElement.
I just want to store value in variable and print it, I have tried below code but no result :
WebElement Key = driver.findElement(By.xpath("//div[2]/label/strong/following-sibling::text()")); String vs =Key.getText(); System.out.println("key Name..!!!" + vs);
Suggest Me Opinions
<input>
tag in theHTML
you shared, can you update the question including the tag? You may like to expand the firstdiv
too withclass=form-group
- DebanjanB