Last active
August 29, 2015 14:23
-
-
Save tanish-kr/bd5a76b536ff472d87bb to your computer and use it in GitHub Desktop.
【Selenium】python3でphantomjs実行時のログ出力先の変更 ref: http://qiita.com/tatsu_nishiki/items/b40747ff25ad5c7167ea
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from selenium import webdriver | |
# driverの指定 | |
driver = webdriver.PhantomJS() | |
driver.set_window_size(1024, 768) | |
driver.get('https://google.com/') | |
# キャプチャ | |
driver.save_screenshot('google.png') | |
driver.quit() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
log_name = '/tmp/phantomjs.log' | |
driver = webdriver.PhantomJS(service_log_path=log_name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
log_name = '/tmp/phantomjs.log' | |
driver = webdriver.PhantomJS(service_log_path=log_name,service_args=["--webdriver-loglevel=ERROR"]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import sys | |
driver = webdriver.PhantomJS(service_log_path=os.ttyname(sys.stdout.fileno())) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
driver = webdriver.PhantomJS(service_log_path=os.path.devnull) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment