forked from nwjs/nw.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Cong Liu
committed
Jan 13, 2016
1 parent
c1aa5cb
commit 33a5999
Showing
4 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<title>Inspect Crash</title> | ||
</head> | ||
<body> | ||
<button id="require" onclick="require('./test.js')">require</button> | ||
<script> | ||
chrome.developerPrivate.openDevTools({renderViewId: -1, renderProcessId: -1, extensionId: chrome.runtime.id}) | ||
</script> | ||
</body> | ||
</html> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"name": "issue3835-inspect-crash", | ||
"main": "index.html" | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
console.log('hello') |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import time | ||
import os | ||
|
||
from selenium import webdriver | ||
from selenium.webdriver.chrome.options import Options | ||
|
||
chrome_options = Options() | ||
chrome_options.add_argument("nwapp=" + os.path.dirname(os.path.abspath(__file__))) | ||
|
||
driver = webdriver.Chrome(executable_path=os.environ['CHROMEDRIVER'], chrome_options=chrome_options) | ||
driver.implicitly_wait(2) | ||
time.sleep(1) | ||
try: | ||
print driver.current_url | ||
driver.find_element_by_id('require').click() | ||
time.sleep(2) # wait for background devtools open | ||
driver.switch_to_window(driver.window_handles[-1]) | ||
# necessary compatible for older alphaN | ||
# where devtools is loaded in an iframe | ||
inspector_frames = driver.find_elements_by_id('inspector-app-iframe') | ||
if inspector_frames: | ||
driver.switch_to_frame(inspector_frames[0]) | ||
driver.execute_script('return document.querySelector(".inspector-view-tabbed-pane").shadowRoot.getElementById("tab-console")').click() | ||
driver.find_element_by_class_name('console-message-url').click() | ||
sources_panel = driver.find_element_by_css_selector('.panel.sources') | ||
assert(sources_panel is not None) | ||
# driver.switch_to_active_element().send_keys('chrome\n') | ||
# driver.find_element_by_class_name('console-object-preview').click() | ||
# time.sleep(1) # wait for crash! | ||
# expanded = driver.find_element_by_css_selector('.console-view-object-properties-section.expanded') | ||
# assert(expanded is not None) | ||
finally: | ||
driver.quit() |