質問編集履歴
1
書式の改善
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
jsにpython3で作成したlistを渡
|
test
CHANGED
@@ -1,47 +1,7 @@
|
|
1
|
-
```python
|
2
|
-
|
3
|
-
|
1
|
+
hogeListには別スクリプト(python)で作成した配列が入っています。(配列は文字と数字が入っています)
|
4
2
|
|
5
3
|
|
6
|
-
|
7
|
-
```
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
hogeListには別スクリプト(python)で作成した配列が入っています。(配列は文字と数字が入っています)
|
12
|
-
|
13
|
-
このまま実行すると以下のエラーがでます。
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
```Error
|
18
|
-
|
19
|
-
Traceback (most recent call last):
|
20
|
-
|
21
|
-
driver.execute_script('document.getElementById("hoge").contentWindow.document.write("<html><body>'+ hogeList +'</body></html>");')
|
22
|
-
|
23
|
-
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 543, in execute_script
|
24
|
-
|
25
|
-
'args': converted_args})['value']
|
26
|
-
|
27
|
-
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 308, in execute
|
28
|
-
|
29
|
-
self.error_handler.check_response(response)
|
30
|
-
|
31
|
-
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/selenium/webdriver/remote/errorhandler.py", line 194, in check_response
|
32
|
-
|
33
|
-
raise exception_class(message, screen, stacktrace)
|
34
|
-
|
35
|
-
selenium.common.exceptions.WebDriverException: Message: unknown error: Runtime.evaluate threw exception: SyntaxError: Invalid or unexpected token
|
36
|
-
|
37
|
-
(Session info: chrome=62.0.3202.94)
|
38
|
-
|
39
|
-
(Driver info: chromedriver=2.33.506106 (8a06c39c4582fbfbab6966dbb1c38a9173bfb1a2),platform=Mac OS X 10.12.6 x86_64)
|
40
|
-
|
41
|
-
```
|
42
4
|
|
43
5
|
|
44
6
|
|
45
7
|
hogeListを"a"など配列以外のものにすると動作します。
|
46
|
-
|
47
|
-
自分の考えではpython3の配列をjavascriptで読み込めるようにしていないからなのかなと思うのですが調べてみてもイマイチうまくいかないので質問させていただきます。
|