Skip to content
This repository has been archived by the owner on Apr 1, 2023. It is now read-only.

Setting user-agent not working #449

Open
jonyking opened this issue Aug 9, 2021 · 2 comments
Open

Setting user-agent not working #449

jonyking opened this issue Aug 9, 2021 · 2 comments

Comments

@jonyking
Copy link

jonyking commented Aug 9, 2021

Hello,

we've got the problem that setting the user-agent will end up in "You use an unknown device or you are in privacy mode", so we can not access some websites. Do you have a solution for this?

require('vendor/autoload.php');
set_time_limit('0');

error_reporting(E_ALL);


/*
$client = new \Goutte\Client([
]);*/
$driver = new \Behat\Mink\Driver\GoutteDriver();

$session = new \Behat\Mink\Session($driver);

// start the session
$session->start();
$session->visit('URL');

$page = $session->getPage();

$loginForm = $page->findById('loginForm');
$loginFormUsername = $loginForm->findField('userName');
if (null === $loginFormUsername) {
throw new \Exception('The element is not found');
} else {
$loginFormUsername->setValue('USERNAME');
}
$loginFormPassword = $loginForm->findField('password');
if (null === $loginFormPassword) {
throw new \Exception('The element is not found');
} else {
$loginFormPassword->setValue('PASSWD');
}

$loginForm->submit();
print_r($loginForm);
@jonyking
Copy link
Author

Some suggestions?

@georaldc
Copy link

Have you tried using a your own guzzle instance that has a custom user agent defined?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants