panther icon indicating copy to clipboard operation
panther copied to clipboard

clickLink not working with special characters.

Open iBuaSpaz opened this issue 1 year ago • 1 comments

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..

menu

iBuaSpaz avatar Dec 28 '22 16:12 iBuaSpaz

Obviously, the element you want to click is blocked by another element. Check your page carefully.

jumaris88 avatar Jan 11 '24 15:01 jumaris88