第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

單擊部分標(biāo)記內(nèi)的元素

單擊部分標(biāo)記內(nèi)的元素

慕標(biāo)琳琳 2023-05-17 16:08:33
元素在標(biāo)簽內(nèi),但嘗試了很多方法都無(wú)法點(diǎn)擊它。wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//input[@value='Login to Register']"))).click();和WebElement element = driver.findElement(By.xpath("//input[@value='Login to Register']"));JavascriptExecutor jsEx= (JavascriptExecutor)driver;jsEx.executeScript("arguments[0].click();", element);這是 html:<div id="requestRegistrationWidget">     <a id="requestLocationLogin" href="/user/login?destination=%2Fsearch%2Flocations%2Fwidget%3Fparam1%3D006046-0619_1565278200_11000000%26param2%3D3" class="use-ajax login-popup-form" data-dialog-type="modal">        <input class="btn btn-primary" style="width: 100% !important;" type="button" value="Login to Register"></input>    </a>      <!-- registerSession == 3 and registerAnyActiveSession == 1 case (2) --> </div>
查看完整描述

3 回答

?
回首憶惘然

TA貢獻(xiàn)1847條經(jīng)驗(yàn) 獲得超11個(gè)贊

你能試試下面的代碼嗎?


WebDriverWait wait = new WebDriverWait(driver, 30);

wait.until(ExpectedConditions.elementToBeClickable(By.id("requestLocationLogin"))).click();



查看完整回答
反對(duì) 回復(fù) 2023-05-17
?
慕村9548890

TA貢獻(xiàn)1884條經(jīng)驗(yàn) 獲得超4個(gè)贊

我想你在 chrome 上遇到了這個(gè)問(wèn)題。試試這個(gè),它對(duì)我有用。

element.sendKeys(Keys.RETURN);

它只是點(diǎn)擊元素上的“輸入”按鈕。


查看完整回答
反對(duì) 回復(fù) 2023-05-17
?
達(dá)令說(shuō)

TA貢獻(xiàn)1821條經(jīng)驗(yàn) 獲得超6個(gè)贊

click()在帶有文本的元素上登錄以注冊(cè),因?yàn)樵撛厥侵С諥JAX的元素,您必須為此引入WebDriverWaitelementToBeClickable(),并且您可以使用以下任一定位器策略:

  • cssSelector:

    new?WebDriverWait(driver,?20).until(ExpectedConditions.elementToBeClickable(By.cssSelector("a.use-ajax.login-popup-form#requestLocationLogin>input.btn.btn-primary[value='Login?to?Register']"))).click();
  • xpath:

    new?WebDriverWait(driver,?20).until(ExpectedConditions.elementToBeClickable(By.xpath("http://a[@class='use-ajax?login-popup-form'?and?@id='requestLocationLogin']/input[@class='btn?btn-primary'?and?@value='Login?to?Register']"))).click();



查看完整回答
反對(duì) 回復(fù) 2023-05-17
  • 3 回答
  • 0 關(guān)注
  • 184 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)