在线不卡日本ⅴ一区v二区_精品一区二区中文字幕_天堂v在线视频_亚洲五月天婷婷中文网站

  • <menu id="lky3g"></menu>
  • <style id="lky3g"></style>
    <pre id="lky3g"><tt id="lky3g"></tt></pre>

    「Web UI自動(dòng)化測試」element is not clickable at point解決辦法

    今天有同事在我們測試平臺(tái)上編寫UI測試用例,有個(gè)【確定】按鈕頁面上可以正常操作,根據(jù)所寫的xpath路徑也能找到這個(gè)元素。但是在執(zhí)行UI腳本時(shí)報(bào)錯(cuò):提示is not clickable at point (1183, 607)。

    2022-06-20 11:50:55:674:ERROR autotestclient.execution.webdriver.ex.WebCaseExecution.runWebStep(WebCaseExecution.java:226) – 元素定位過程或是操作過程失敗或異常!

    org.openqa.selenium.ElementClickInterceptedException: element click intercepted: Element … is not clickable at point (1183, 607). Other element would receive the click: …

    (Session info: chrome=102.0.5005.115)

    Build info: version: ‘3.141.59’, revision: ‘e82be7d358’, time: ‘2018-11-14T08:17:03’

    System info: host: ‘LAPTOP-DHR34KHR’, ip: ‘172.30.192.1’, os.name: ‘Windows 10’, os.arch: ‘amd64’, os.version: ‘10.0’, java.version: ‘1.8.0_73’

    Driver info: org.openqa.selenium.chrome.ChromeDriver

    Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 102.0.5005.115, chrome: {chromedriverVersion: 101.0.4951.41 (93c720db8323…, userDataDir: C:UsersADMINI~1AppDataL…}, goog:chromeOptions: {debuggerAddress: localhost:22005}, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: WINDOWS, platformName: WINDOWS, proxy: Proxy(), setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:extension:credBlob: true, webauthn:extension:largeBlob: true, webauthn:virtualAuthenticators: true}

    Session ID: f2569c51b6fe8840df94fdbc5ac4b09c

    一開始以為是頁面元素未加載出來、或者被其他頁面元素覆蓋了、或者頁面元素是在iframe層里面。經(jīng)排查,這個(gè)報(bào)錯(cuò)并不是非以上常見的原因。

    于是從網(wǎng)上搜索解決辦法,網(wǎng)上給出的解決辦法基本上都是使用js模擬鼠標(biāo)點(diǎn)擊的辦法,使用該方法的確可以點(diǎn)【確定】按鈕,但是它把所有的彈窗頁面都關(guān)閉。不得其解,只能另找途徑進(jìn)行解決。

    WebElement element = driver.findElement(By.xpath(“element_xpath”));

    JavascriptExecutor executor = (JavascriptExecutor)driver;

    executor.executeScript(“arguments[0].click();”, element);

    最終,筆者突然想到,在webdriver中,有專門的一個(gè)類,是用來進(jìn)行鼠標(biāo)、鍵盤的模擬操作的,那就是Actions類,或許可以使用這種折中的解決辦法,來模擬鼠標(biāo)左鍵單擊頁面元素操作。問題最終得以解決。

    #頁面元素

    WebElement element = driver.findElement(By.xpath(“element_xpath”));

    Actions action = new Actions(driver);

    #模擬鼠標(biāo)左鍵單擊頁面元素

    action.click(element);

    鄭重聲明:本文內(nèi)容及圖片均整理自互聯(lián)網(wǎng),不代表本站立場,版權(quán)歸原作者所有,如有侵權(quán)請聯(lián)系管理員(admin#wlmqw.com)刪除。
    上一篇 2022年6月22日 12:02
    下一篇 2022年6月22日 12:02

    相關(guān)推薦

    聯(lián)系我們

    聯(lián)系郵箱:admin#wlmqw.com
    工作時(shí)間:周一至周五,10:30-18:30,節(jié)假日休息