我正在使用Mink 1.4,使用 Goutte 驱动程序。
我试图在页面中设置一些表单字段值,然后单击提交该表单的按钮。
但后来我得到这个错误
Fatal error: Uncaught exception 'Guzzle\Http\Exception\CurlException' with message ' in phar://C:/Documents and Settings/User/My Documents/Dropbox/kar_rental/inc/mink.phar/vendor/guzzle/guzzle/src/Guzzle/Http/Curl/CurlMulti.php on line 579
Guzzle\Http\Exception\CurlException: [curl] 60: SSL certificate problem, verify that the CA cert is OK...
我假设由于我设置CURLOPT_SSL_VERIFYPEER
为 false,它不应该检查 SSL。
这是我的代码:
foreach ($this->_sites_data as $site_name => $site_data)
{
// Instantiate Mink's Goutte Driver
$clientOptions = array(
'curl.options' => array(
'CURLOPT_SSL_VERIFYPEER' => false,
'CURLOPT_CERTINFO' => false,
'CURLOPT_TIMEOUT' => 120
),
'ssl.certificate_authority' => 'system'
);
$client = new \Behat\Mink\Driver\Goutte\Client();
$client->setClient(new \Guzzle\Http\Client($site_data['form_data']['form_url'], $clientOptions));
$driver = new \Behat\Mink\Driver\GoutteDriver($client);
// Initialize Mink
$session = new \Behat\Mink\Session($driver);
// Start session
$session->start();
foreach ($site_data['form_data']['post_fields'] as $days => $post_fields)
{
// Open form page
$session->visit($site_data['form_data']['form_url']);
$page = $session->getPage();
foreach ($post_fields as $post_field_name => $post_field_value)
{
$el = $page->find('css', '#' . $post_field_name);
$el->setValue($post_field_value);
}
$el = $page->find('css', $site_data['form_data']['submit_element_css']);
$el->click();
}
$session->reset();
}