Advertisement
TakesxiSximada

phantomsjsをちゃんと葬る

Jun 8th, 2016
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.73 KB | None | 0 0
  1. from selenium.webdriver.phantomjs.webdriver import RemoteWebDriver
  2. from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
  3.  
  4.  
  5. class WebDriver(RemoteWebDriver):
  6.     def __init__(self, executable_path="phantomjs",
  7.                  port=0, desired_capabilities=DesiredCapabilities.PHANTOMJS,
  8.                  service_args=None, service_log_path=None):
  9.  
  10.         super(WebDriver, self).__init__(
  11.             command_executor='http://127.0.0.1:8910/wd/hub',
  12.             desired_capabilities=DesiredCapabilities.PHANTOMJS,
  13.         )
  14.  
  15.     def quit(self):
  16.         self.command_executor._request(
  17.             'GET', '{}/shutdown'.format(self.command_executor._url), 'shutdown')
  18.  
  19. driver = WebDriver()
  20. driver.quit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement