質問編集履歴
2
コードの言語名を記載しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -15,7 +15,7 @@
|
|
15
15
|
・send.keysでテキストを入力しようとすると、下記のエラーメッセージが出て実行できません。
|
16
16
|
・.clickや.textは実行ができるため、指定しているxpathは間違っていないと思われます。
|
17
17
|
|
18
|
-
```
|
18
|
+
```python
|
19
19
|
ElementNotInteractableException Traceback (most recent call last)
|
20
20
|
Input In [14], in <cell line: 2>()
|
21
21
|
1 weekinput = driver.find_element_by_xpath('//*[@id="tableau_base_widget_LegacyQuantitativeQuickFilter_0"]/div/div[2]/div[2]/input')
|
@@ -50,7 +50,8 @@
|
|
50
50
|
|
51
51
|
### 該当のソースコード
|
52
52
|
|
53
|
-
```
|
53
|
+
```python
|
54
|
+
|
54
55
|
week = driver.find_element_by_xpath('//*[@id="tableau_base_widget_LegacyQuantitativeQuickFilter_0"]/div/div[2]/div[2]/input')
|
55
56
|
week.send_keys('33')
|
56
57
|
```
|
@@ -61,14 +62,14 @@
|
|
61
62
|
・inputタグの1つ上の階層のdivタグの方は.click()で選択することができましたが、inputタグの方はclickもsend_keysもできない状況です。
|
62
63
|
・このダッシュボードはiframeが使われていたため、最初に下記のコードでiframe内の操作に切り換えています。(切り替える前はclickもできませんでしたが、切り換えることで操作ができるようになりました)
|
63
64
|
|
64
|
-
```
|
65
|
+
```python
|
65
66
|
iframe = driver.find_element_by_xpath('//*[@id="viz"]/iframe')
|
66
67
|
driver.switch_to.frame(iframe)
|
67
68
|
```
|
68
69
|
|
69
70
|
### 補足情報(FW/ツールのバージョンなど)
|
70
71
|
ご参考に、週数を入力したい箇所のhtmlを記載いたします。
|
71
|
-
```
|
72
|
+
```html
|
72
73
|
<div class="QFReadout QFUpperBound tab-ctrl-formatted-border-hover active" dojoattachevent="onclick:showUpperInput" dojoattachpoint="domUpperBound" style="width: 74px;"><div class="readoutText tab-ctrl-formatted-fixedsize" dojoattachpoint="domUpperText" style="display: none;">32</div><input type="text" dojoattachpoint="domUpperInput" style="width: 74px;"></div>
|
73
74
|
|
74
75
|
<div class="readoutText tab-ctrl-formatted-fixedsize" dojoattachpoint="domUpperText" style="display: none;">32</div>
|
1
ご指摘いただいた通り、コードとエラーメッセージを正しいものに修正致しました。宜しくお願い致します。
test
CHANGED
File without changes
|
test
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
(質問投稿初めてのため、不足情報などありましたらすみません)
|
4
4
|
PythonのSeleniumでWebページの操作を行うプログラムを書いているのですが、以下のエラーがどうしても解決できず、どなたかご教示をいただけますと幸いです。
|
5
|
-
操作したいWebページが、TableauというBIツール
|
5
|
+
操作したいWebページが、TableauというBIツールでifameが使われているなど、やや複雑な構造となっております。
|
6
6
|
|
7
7
|
### 実現したいこと
|
8
8
|
|
@@ -17,26 +17,54 @@
|
|
17
17
|
|
18
18
|
```
|
19
19
|
ElementNotInteractableException Traceback (most recent call last)
|
20
|
-
Input In [
|
20
|
+
Input In [14], in <cell line: 2>()
|
21
|
-
1 week = driver.find_element_by_xpath('//*[@id="tableau_base_widget_LegacyQuantitativeQuickFilter_0"]/div/div[2]/div[2]/
|
21
|
+
1 weekinput = driver.find_element_by_xpath('//*[@id="tableau_base_widget_LegacyQuantitativeQuickFilter_0"]/div/div[2]/div[2]/input')
|
22
|
-
2 week.click()
|
23
|
-
---->
|
22
|
+
----> 2 weekinput.send_keys('33')
|
23
|
+
|
24
|
+
File c:\users\yuuka\appdata\local\programs\python\python38\lib\site-packages\selenium\webdriver\remote\webelement.py:540, in WebElement.send_keys(self, *value)
|
25
|
+
537 remote_files.append(self._upload(file))
|
26
|
+
538 value = '\n'.join(remote_files)
|
27
|
+
--> 540 self._execute(Command.SEND_KEYS_TO_ELEMENT,
|
28
|
+
541 {'text': "".join(keys_to_typing(value)),
|
29
|
+
542 'value': keys_to_typing(value)})
|
30
|
+
|
31
|
+
File c:\users\yuuka\appdata\local\programs\python\python38\lib\site-packages\selenium\webdriver\remote\webelement.py:710, in WebElement._execute(self, command, params)
|
32
|
+
708 params = {}
|
33
|
+
709 params['id'] = self._id
|
34
|
+
--> 710 return self._parent.execute(command, params)
|
35
|
+
|
36
|
+
File c:\users\yuuka\appdata\local\programs\python\python38\lib\site-packages\selenium\webdriver\remote\webdriver.py:424, in WebDriver.execute(self, driver_command, params)
|
37
|
+
422 response = self.command_executor.execute(driver_command, params)
|
38
|
+
423 if response:
|
39
|
+
--> 424 self.error_handler.check_response(response)
|
40
|
+
425 response['value'] = self._unwrap_value(
|
41
|
+
426 response.get('value', None))
|
42
|
+
427 return response
|
43
|
+
|
44
|
+
File c:\users\yuuka\appdata\local\programs\python\python38\lib\site-packages\selenium\webdriver\remote\errorhandler.py:247, in ErrorHandler.check_response(self, response)
|
45
|
+
245 alert_text = value['alert'].get('text')
|
46
|
+
246 raise exception_class(message, screen, stacktrace, alert_text) # type: ignore[call-arg] # mypy is not smart enough here
|
47
|
+
--> 247 raise exception_class(message, screen, stacktrace)
|
48
|
+
|
24
49
|
```
|
25
50
|
|
26
51
|
### 該当のソースコード
|
27
52
|
|
28
53
|
```ここに言語名を入力
|
29
|
-
week = driver.find_element_by_xpath('//*[@id="tableau_base_widget_LegacyQuantitativeQuickFilter_0"]/div/div[2]/div[2]/
|
54
|
+
week = driver.find_element_by_xpath('//*[@id="tableau_base_widget_LegacyQuantitativeQuickFilter_0"]/div/div[2]/div[2]/input')
|
30
|
-
week.click()
|
31
55
|
week.send_keys('33')
|
32
56
|
```
|
33
57
|
|
34
58
|
### 試したこと
|
35
59
|
|
36
|
-
・週数を入力する場所にはいくつかのセクションがあったため、上の階層から一番下の階層まで全てのxpathで試してみましたが駄目でした。
|
37
|
-
・
|
60
|
+
・xpath以外にもidやclass nameなどでも試しましたが全てエラーとなってしまいました。
|
61
|
+
・inputタグの1つ上の階層のdivタグの方は.click()で選択することができましたが、inputタグの方はclickもsend_keysもできない状況です。
|
38
|
-
・このダッシュボードはiframeが使われていたため、最初に
|
62
|
+
・このダッシュボードはiframeが使われていたため、最初に下記のコードでiframe内の操作に切り換えています。(切り替える前はclickもできませんでしたが、切り換えることで操作ができるようになりました)
|
39
63
|
|
64
|
+
```ここに言語を入力
|
65
|
+
iframe = driver.find_element_by_xpath('//*[@id="viz"]/iframe')
|
66
|
+
driver.switch_to.frame(iframe)
|
67
|
+
```
|
40
68
|
|
41
69
|
### 補足情報(FW/ツールのバージョンなど)
|
42
70
|
ご参考に、週数を入力したい箇所のhtmlを記載いたします。
|