Seleniumの動作(状態別/3:Firefox)
Firefox
![77.0.1](https://selenium-world.net/wp-content/uploads/2020/07/fx_version.png)
Button
クリック
ロケータ欄にidを入力して、「id」ボタン押下。要素が取得できたら「click」ボタン押下。
操作が成功すると、生成コード欄に、実行したPythonコードが出力されます。
ノーマル
![クリックイベント発生](https://selenium-world.net/wp-content/uploads/2020/06/fx_submit1_c1-1024x616.png)
非活性(disabled)
![反応なし](https://selenium-world.net/wp-content/uploads/2020/06/fx_submit2_c1-1024x616.png)
非活性(pointer-events:none)
![例外発生](https://selenium-world.net/wp-content/uploads/2020/06/fx_submit3_c1-1024x616.png)
ElementClickInterceptedExceptionMessage: Element <input id="submit3" class="btn-submit" type="submit"> is not clickable at point (831,446) because it does not have pointer events enabled, and element <div> would receive the click instead
<traceback object at 0x000001CC524FF348>
読み取り専用(readonly)
![クリックイベント発生](https://selenium-world.net/wp-content/uploads/2020/06/fx_submit4_c1-1024x616.png)
非表示(display:none)
![例外発生](https://selenium-world.net/wp-content/uploads/2020/06/fx_submit5_c1-1024x616.png)
ElementNotInteractableExceptionMessage: Element <input id="submit5" class="btn-submit" type="submit"> could not be scrolled into view
<traceback object at 0x000001CC50E99E08>
非表示(visibility:hidden)
![例外発生](https://selenium-world.net/wp-content/uploads/2020/06/fx_submit6_c1-1024x616.png)
属性の取得
ノーマル
![属性取得](https://selenium-world.net/wp-content/uploads/2020/06/fx_submit1_e1-1024x616.png)
非活性(disabled)
![属性取得](https://selenium-world.net/wp-content/uploads/2020/06/fx_submit2_e1-1024x616.png)
非活性(pointer-events:none)
![属性取得](https://selenium-world.net/wp-content/uploads/2020/06/fx_submit3_e1-1024x616.png)
読み取り専用(readonly)
![属性取得](https://selenium-world.net/wp-content/uploads/2020/06/fx_submit4_e1-1024x616.png)
非表示(display:none)
![属性取得](https://selenium-world.net/wp-content/uploads/2020/06/fx_submit5_e1-1024x616.png)
非表示(visibility:hidden)
![属性取得](https://selenium-world.net/wp-content/uploads/2020/06/fx_submit6_e1-1024x616.png)
結果
Button | click | is_displayed | is_enabled | readonly | 備考 |
---|---|---|---|---|---|
normal | OK | True | True | None | |
disabled | NG | True | False | None | |
pointer-events:none | Ex | True | True | None | |
readonly | OK | True | True | true | |
display:none | Ex | False | True | None | |
visibility:hidden | Ex | False | True | None |
Link
非活性(disabled)
disabledは効果がないようです。
![クリックイベント発生](https://selenium-world.net/wp-content/uploads/2020/06/fx_link2_c1-1024x616.png)
![](https://selenium-world.net/wp-content/uploads/2020/06/fx_link2_e1-1-1024x616.png)
結果
Link | click | is_displayed | is_enabled | readonly |
---|---|---|---|---|
normal | OK | True | True | None |
disabled | OK | True | True | None |
pointer-events:none | Ex | True | True | None |
readonly | OK | True | True | true |
display:none | Ex | False | True | None |
visibility:hidden | Ex | False | True | None |
Text
非活性(disabled)
![例外発生](https://selenium-world.net/wp-content/uploads/2020/06/fx_text2_c1-1024x616.png)
ElementNotInteractableExceptionMessage: Element <input id="textbox2" type="text"> is not reachable by keyboard
<traceback object at 0x000001A24CE10F08>
非表示(display:none)
![例外発生](https://selenium-world.net/wp-content/uploads/2020/06/fx_text5_c1-1024x616.png)
ElementNotInteractableExceptionMessage: Element <input id="textbox5" type="text"> is not reachable by keyboard
<traceback object at 0x000001A249B6EC88>
結果
Text | 文字入力 | 値の取得 | is_displayed | is_enabled | readonly |
---|---|---|---|---|---|
noraml | OK | OK | True | True | None |
disabled | Ex | OK | True | False | None |
pointer-events:none | OK | OK | True | True | None |
readonly | NG | OK | True | True | true |
display:none | Ex | OK | False | True | None |
visibility:hidden | Ex | OK | False | True | None |
Select
非活性(disabled)
リストが非活性にも関わらず「option2」が選択されました。
手動では選択できません。
![option2選択](https://selenium-world.net/wp-content/uploads/2020/06/fx_select2_c1-1024x616.png)
非活性(pointer-events:none)
例外が発生しました。
![例外発生](https://selenium-world.net/wp-content/uploads/2020/06/fx_select3_c1-1024x616.png)
ElementClickInterceptedExceptionMessage: Element <select id="select3"> is not clickable at point (831,564) because it does not have pointer events enabled, and element <div> would receive the click instead
<traceback object at 0x000001A24CE14848>
非表示(display:none)
例外が発生します。
![例外発生](https://selenium-world.net/wp-content/uploads/2020/07/fx_select5_v1-1024x616.png)
<option>項目は空文字で返ってきます。
![option項目](https://selenium-world.net/wp-content/uploads/2020/07/fx_select5_v3-1024x616.png)
結果
Select | 項目選択 | 選択項目の取得 | is_displayed | is_enabled | readonly | 備考 |
---|---|---|---|---|---|---|
normal | OK | OK | True | True | None | |
disabled | OK* | OK | True | False | None | *手動は選択不可 |
pointer-events:none | Ex | OK | True | True | None | |
readonly | OK | OK | True | True | true | |
display:none | Ex | NG* | False | True | None | *空文字が返る |
visibility:hidden | Ex | NG* | False | True | None | *空文字が返る |
Select(option項目)
非活性(pointer-events:none)
「option2」が選択されました。
![option2選択](https://selenium-world.net/wp-content/uploads/2020/06/fx_select13_c1-1024x616.png)
非表示(display:none)
「option2」は非表示にも関わらず、選択可能です。
![option2選択](https://selenium-world.net/wp-content/uploads/2020/06/fx_select15_c1-1024x616.png)
![option2非表示](https://selenium-world.net/wp-content/uploads/2020/06/fx_select15_c2.png)
「option2」は非表示にも関わらずis_displayed()は「True」になります。
![属性取得](https://selenium-world.net/wp-content/uploads/2020/06/fx_select15_e1-1024x616.png)
非表示(visibility:hidden)
「option2」が選択されます。
![option2選択](https://selenium-world.net/wp-content/uploads/2020/06/fx_select16_c1-1024x616.png)
Firefoxでは、<select>の<option>に「visibility:hidden」は無効なようです。
![option2表示](https://selenium-world.net/wp-content/uploads/2020/06/fx_select16_c2.png)
結果
Select (option) |
項目選択 | 選択項目の取得 | is_displayed | is_enabled | readonly | 備考 |
---|---|---|---|---|---|---|
normal | OK | OK | True | True | None | |
disabled | NG | OK | True | False | None | |
pointer-events:none | OK | OK | True | True | None | |
readonly | OK | OK | True | True | true | |
display:none | OK* | OK | True | True | None | *手動は選択不可 |
visibility:hidden | OK | OK | True | True | None |
Radio
非活性(pointer-events:none)
![例外発生](https://selenium-world.net/wp-content/uploads/2020/06/fx_radio3_c1-1024x616.png)
ElementClickInterceptedExceptionMessage: Element <input id="radio_3" name="radio" type="radio"> is not clickable at point (800,389) because it does not have pointer events enabled, and element <div> would receive the click instead
<traceback object at 0x000001F89703BD48>
非表示(display:none)
![例外発生](https://selenium-world.net/wp-content/uploads/2020/06/fx_radio5_c1-1024x616.png)
ElementNotInteractableExceptionMessage: Element <input id="radio_5" name="radio" type="radio"> could not be scrolled into view
<traceback object at 0x000001F89703B548>
なお、labelをクリックした場合は選択可能です。
![Radio_5=true](https://selenium-world.net/wp-content/uploads/2020/06/fx_radio5_v1-1024x616.png)
結果
Radio | ボタンclick | ラベルclick | 値の取得 | is_displayed | is_enabled | readonly |
---|---|---|---|---|---|---|
normal | OK | OK | OK | True | True | None |
disabled | NG | NG | OK | True | False | None |
pointer-events:none | Ex | OK | OK | True | True | None |
readonly | OK | OK | OK | True | True | true |
display:none | Ex | OK | OK | False | True | None |
visibility:hidden | Ex | OK | OK | False | True | None |
CheckBox
Radioと同じ結果でした。
結果
CheckBox | ボタンclick | ラベルclick | 値の取得 | is_displayed | is_enabled | readonly |
---|---|---|---|---|---|---|
normal | OK | OK | OK | True | True | None |
disabled | NG | NG | OK | True | False | None |
pointer-events:none | Ex | OK | OK | True | True | None |
readonly | OK | OK | OK | True | True | true |
display:none | Ex | OK | OK | False | True | None |
visibility:hidden | Ex | OK | OK | False | True | None |
ディスカッション
コメント一覧
まだ、コメントがありません