2011-06-15 12 views
7

Bu kod yalnızca * googlechrome içinde çalışır. * Ateş içindeSelenium'da open() işlevinden önce çerez oluşturma()

$this->browserBot->setCommandLineFlags('commandLineFlags=--disable-web-security'); 
$this->browserBot->setBrowser('*googlechrome'); 
$this->browserBot->setHost('localhost'); 
$this->browserBot->setPort(4444); 

$this->browserBot->setBrowserUrl('http://example.com'); 
$this->browserBot->start(); 
$this->browserBot->createCookie('foo=bar', 'path=/; domain=.example.com'); 
$this->browserBot->open('http://example.com/print_cookie.php'); 

ve * iexplore çalışan tek bu:

$this->browserBot->start(); 
$this->browserBot->open('http://example.com/blank_page.html'); 
$this->browserBot->createCookie('foo=bar', 'path=/; domain=.example.com'); 
$this->browserBot->open('http://example.com/print_cookie.php'); 

Ben vs. * Ateş ve içinde (yedekli open() çağrısı olmadan)) (açık önce çerez oluşturabilir miyim?

cevap

3

Bu, her seferinde tarayıcıya neyin enjekte edildiğine bağlıdır.

Dokümanladığınız ikinci yol, birden çok tarayıcı sürümü üzerinde çalıştığından emin olmak için yapacağım yoldur. Bunu her tarayıcı için ilk yolu yapabileceğinizi düşünmüyorum.