Symfony Panther Xpath: how to click on element containing specific text (PHP)
Let's look at an example. This code will click on the text containing the word "test". The element must be clickable.
$client = Client::createChromeClient();
$client->request('GET', 'https://testsite.com/'); //opens website
$client->findElement(WebDriverBy::xpath("//*[contains(text(),'test')]"))->click();
$client->close();
Comments