panther
panther copied to clipboard
clickLink not working with special characters.
Hi, seems this wont work with special characters like »
This is the code
<?php
include('../vendor/autoload.php');
use PHPUnit\Framework\TestCase;
use Symfony\Component\BrowserKit\HttpBrowser;
use Symfony\Component\Panther\Client;
class PantherTest
{
public function __construct()
{
}
function test()
{
try
{
$options = [
'--headless',
'--no-sandbox',
'--disable-gpu'
];
$client = Client::createChromeClient('D:\xampp\htdocs\drivers\chromedriver.exe', null, $options, null);
$client->request('GET', 'https://www.lauritz.com/da/auktioner/?IST=0&SelectedTab=12');
$crawler = $client->waitFor('#FooterArticleControl_BackToTopText');
$client->takeScreenshot('screen.png'); // Yeah, screenshot!
// remove cookie popup
try {
$link = $client->clickLink('Tillad alle cookies');
}
catch(InvalidArgumentException $e){}
$client->clickLink('»');
$crawler = $client->waitFor('#FooterArticleControl_BackToTopText');
$client->takeScreenshot('screen1.png'); // Yeah, screenshot!
print "* success <br>";
}
catch(Exception $e)
{
print "* Error " . var_dump($e) . "<br>";
}
}
}
$testclient = new PantherTest();
$testclient->test();
?>
The error is:
object(Facebook\WebDriver\Exception\ElementClickInterceptedException)#18 (8) { ["message":protected]=> string(311) "element click intercepted: Element ... is not clickable at point (345, 602). Other element would receive the click: ...
So it seems to select the menu ... instead of choosen », and the ... isnt active on first page..
Obviously, the element you want to click is blocked by another element. Check your page carefully.