###前提・実現したいこと
Selenium+Javaを使用してスクリプトを作成していており、
2つの箇所で、ID/className/linkText等で要素を取得できず困っています。
何らかの方法で要素を取得する方法があれば教えていただきたいです。
①は検索画面で、インプットエリアを特定したいです。
②は普通の画面に見えるのですが、どうしてもエラーが出ます。
###発生している問題・エラーメッセージ
①ソース:<div id="src_keyword_input"> <input id="searchCond.query" class="searchQuery" type="text" value="" size"25" maxlength="128" name="searchCond.query"></input> </div> エラー:Unable to locate element:("method":"id","selector":"src_keyword_input") ②ソース:<div id="kamoku_jimute" class="top_kamoku_list"> <ul> <li class="L01"> <a href"jimute/index.html?kamoku=01">共通</a> エラー:Unable to locate element:{("method":"css selector","selector":"#kamoku_jimute>a[href='jimute/index.html?kamoku=01']}
###該当のソースコード
①WebElement searchButton = driver.findElement(By.id("src_keyword_input")); ②WebElement common = driver.findElement(By.cssSelector("#kamoku_jimute>a[href='jimute/index.html?kamoku=01']"));
###試したこと
Byに対してid,className,linkTextだけでなく、xpath,cssSelector等
書き換えて実行しましたが、エラーを解消できませんでした。
WebElementに対する理解が浅いため間違っている可能性も高いですが、
実行できる方法を教えていただけますでしょうか。
###補足情報(言語/FW/ツール等のバージョンなど)
より詳細な情報
あなたの回答
tips
プレビュー