selenium chromedriver usage
博客专区 > jeffsui 的博客 > 博客详情
selenium chromedriver usage
jeffsui 发表于2年前
selenium chromedriver usage
  • 发表于 2年前
  • 阅读 44
  • 收藏 0
  • 点赞 1
  • 评论 0
摘要: selenium chromedriver usage

#selenium chrome usage

environment

  • win7
  • python2.7.11
  • selenium2.51

##1.Selenium support browser type

  • default : firefox

  • chrome

  • IE

  • safari

##2. chromedriver usage

###2.1 Download chromedriver here.

###2.2 Paste the chromedriver.exe file in "C:\Python27\Scripts" Folder.

##3. Test ###3.1 start selenium grid hub you can follow my pre blog selenium grid2

###3.2 Code


options=webdriver.ChromeOptions()
	options.add_argument('--disable-logging')	
	driver=webdriver.Remote("http://localhost:4200/wd/hub",desired_capabilities=options.to_capabilities())

###3.3 run your script

if chrome is opening successfully,it works.

##4. Exception you might got this error message: > Caused by: java.lang.IllegalStateException: The path to the driver executable mu st be set by the webdriver.chrome.driver system property; for more information, see https://github.com/SeleniumHQ/selenium/wiki/ChromeDriver. The latest version can be downloaded from http://chromedriver.storage.googleapis.com/index.html

  1. check the chromedriver path is correct or not
  2. chromedriver not support your current chrome version.

##5. another usage

  1. no need to start selenium grid

  2. Code

 capabilities = DesiredCapabilities.CHROME
 capabilities['loggingPrefs'] = {'browser':'ALL'}
driver = webdriver.Chrome(executable_path=chromedriver,desired_capabilities=capabilities)

##6. reference

  1. https://stackoverflow.com/questions/8255929/running-webdriver-chrome-with-selenium/25988106#25988106
共有 人打赏支持
粉丝 291
博文 262
码字总数 73809
×
jeffsui
如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!
* 金额(元)
¥1 ¥5 ¥10 ¥20 其他金额
打赏人
留言
* 支付类型
微信扫码支付
打赏金额:
已支付成功
打赏金额: