Webサイトにフォームを入力しようとしていますが、コードに記載されている要素が見つかりません。要素が表示されない - Selenium - Java Webdriver
マイコード:
new WebDriverWait(driver, 30).until(ExpectedConditions.visibilityOfElementLocated(By.xpath("/html/body/div[1]/form/div/div/input[1]")));
driver.findElement(By.xpath("/html/body/div[1]/form/div/div/input[1]")).sendKeys("TEST");
相対ウェブサイトコード:
<body>
<div id="pf_form" class="pf_formcontainer">
<form id="PF_1" class="form formBoxShadow" style="height: 1600px; width:
1800px; display: block; left: 0px; top: 30px;">
<div id="PF_4Container" class="PageContainer" style="left:0px;top:0px;z-
index:0;position:absolute">
<div id="PF_4" class="page" tabindex="" name="PF_4" style="width: 1800px;
height: 1600px; background-color: rgb(255, 255, 255); display: block;">
<input id="PF_5" class="textinput" name="PF_5" maxlength="99" value=""
onclick="return false;" style="left: 169px; top: 107px; z-index: 6; height:
18px; line-height: 18px; width: 206px; display: block;" type="text">
...
私はフレームPF_4とPF_4Container、そこに運に変更しようとしました。私は身分証明書や他の手段でそれを見つけようとしましたが、これは私のお尻を蹴っています。
形態がここhttp://app.perfectforms.com/PresentationServer/Form.aspx/Play/FdjigAcE?f=FdjigAcE
公的に表示されている任意のガイダンスを大幅に理解されるであろう。私は今数週間これを解決しようとしてきました。
IDを使用すると、どのようなエラーが発生しますか? driver.findElement(By.id( 'PF_5')))。 iframeが表示されません... – Grasshopper
コンソールからの評価パスを使用してxpathパスが正しいかどうか試してみてください - > https://developer.mozilla.org/en/docs/Introduction_to_using_XPath_in_JavaScript –
Andrewに感謝します。それは要素を見つけることができないようです。気軽にURLで実行してください。 –