質問編集履歴
3
誤記修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -33,4 +33,4 @@
|
|
33
33
|
RUN pip3 install chromedriver
|
34
34
|
```
|
35
35
|
|
36
|
-
次に、その起動できたコンテナ内で、[Selenium公式のサンプルプログラム(python_org_search.py)](https://selenium-python.readthedocs.io/getting-started.html)を実行するべく、そのpythonファイルを当該コンテナ内に保存しDockerfile
|
36
|
+
次に、その起動できたコンテナ内で、[Selenium公式のサンプルプログラム(python_org_search.py)](https://selenium-python.readthedocs.io/getting-started.html)を実行するべく、そのpythonファイルを当該コンテナ内に保存しDockerfileやdocker-composeでpython python_org_search.pyを実行できないか、漠然とですが模索しています。
|
2
説明修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
##質問
|
2
|
-
|
2
|
+
[Selenium公式のサンプルプログラム(python_org_search.py)](https://selenium-python.readthedocs.io/getting-started.html)をコンテナ内に保存し、コンテナ起動したときにこのpythonファイルを実行するよう、Dockerfileやdocker-composeに設定する方法(他の方法でも構いません。)をお教えいただけますでしょうか。
|
3
3
|
|
4
4
|
ヒントなどいただけますと誠にありがたく存じます。
|
5
5
|
|
1
説明の修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,9 +1,24 @@
|
|
1
1
|
##質問
|
2
|
-
pythonファイルをコンテナ内に保存し、コンテナ起動したときに
|
2
|
+
pythonファイルをコンテナ内に保存し、コンテナ起動したときに[Selenium公式のサンプルプログラム(python_org_search.py)](https://selenium-python.readthedocs.io/getting-started.html)を実行するよう、Dockerfileやdocker-composeに設定する方法をお教えいただけますでしょうか。
|
3
3
|
|
4
4
|
ヒントなどいただけますと誠にありがたく存じます。
|
5
5
|
|
6
|
+
python_org_search.py
|
7
|
+
```Python
|
8
|
+
from selenium import webdriver
|
9
|
+
from selenium.webdriver.common.keys import Keys
|
6
10
|
|
11
|
+
driver = webdriver.Firefox()
|
12
|
+
driver.get("http://www.python.org")
|
13
|
+
assert "Python" in driver.title
|
14
|
+
elem = driver.find_element_by_name("q")
|
15
|
+
elem.clear()
|
16
|
+
elem.send_keys("pycon")
|
17
|
+
elem.send_keys(Keys.RETURN)
|
18
|
+
assert "No results found." not in driver.page_source
|
19
|
+
driver.close()
|
20
|
+
```
|
21
|
+
|
7
22
|
##実現したいことの大枠
|
8
23
|
Windows10のDocker上で、UbuntuのSeleniumで、ChromeDriverを動作させPythonやJavascriptで特定サイトのDOMを取得しCSVファイルとして書き出す、という流れを実現できないか、勉強しています。
|
9
24
|
|