如何从下面的代码中编写 getText()?
How to write getText() from the below code?
In the below image, there is an h1 tag. Text says, your policy number is ******. Here, Every-time when i run a new test-case, policy number will change. To get that policy number in testng output. What i need to use the code. I mean how can i getText()
您可以通过 xpath 获取元素,然后从中获取文本。
你可以这样做:
driver.findElement(By.xpath("//div[@class='columns large-8']//h1[@class='fontFamily-1']")).getText()
In the below image, there is an h1 tag. Text says, your policy number is ******. Here, Every-time when i run a new test-case, policy number will change. To get that policy number in testng output. What i need to use the code. I mean how can i getText()
您可以通过 xpath 获取元素,然后从中获取文本。
你可以这样做:
driver.findElement(By.xpath("//div[@class='columns large-8']//h1[@class='fontFamily-1']")).getText()