相关疑难解决方法(0)

Selenium-Debugging:元素在点(X,Y)处不可点击

我试图通过Selenium 刮掉这个网站.

我想点击"下一页"按钮,为此我这样做:

 driver.find_element_by_class_name('pagination-r').click()
Run Code Online (Sandbox Code Playgroud)

它适用于许多页面但不适用于所有页面,我收到此错误

WebDriverException: Message: Element is not clickable at point (918, 13). Other element would receive the click: <div class="linkAuchan"></div>
Run Code Online (Sandbox Code Playgroud)

总是为这个页面

我读了这个问题

我试过这个

driver.implicitly_wait(10)
el = driver.find_element_by_class_name('pagination-r')
action = webdriver.common.action_chains.ActionChains(driver)
action.move_to_element_with_offset(el, 918, 13)
action.click()
action.perform()
Run Code Online (Sandbox Code Playgroud)

但我得到了同样的错误

python selenium web-scraping selenium-firefoxdriver selenium-webdriver

42
推荐指数
3
解决办法
3万
查看次数

Selenium - 元素在点上不可点击

我正在使用selenium来测试脚本.我收到以下错误,随机发生此错误.当我跑10次时,我得到了大约两次.所以它不是真正可重复的.有谁知道为什么会这样?我试图点击的元素在浏览器中肯定是可见的并且不会移动,因此不需要调整大小或拖动元素.我正在使用chrome webdriver并且我阅读了其他故障排除策略(调试"元素在点上无法点击"错误)并且它们似乎与我的问题无关.我也等了足够的时间.

UnknownError: unknown error: Element is not clickable at point (167, 403). Other element would receive the click: <div class="leftMasterBackground"></div>
Run Code Online (Sandbox Code Playgroud)

javascript selenium selenium-chromedriver

13
推荐指数
1
解决办法
2万
查看次数

Firefox中的Selenium"Element is not clickable at point"错误

关于Webdriver错误

Element is not clickable at point (X, Y). Another element would recieve the click instead.
Run Code Online (Sandbox Code Playgroud)

对于ChromeDriver,这是在调试"元素在点上无法点击"错误中解决的,但是问题也可能在Firefox中发生.

FirefoxDriver中出现这种情况时解决此问题的最佳方法是什么?

firefox webdriver selenium-webdriver

7
推荐指数
2
解决办法
1万
查看次数

Selenium Webdriver:单击单选按钮不起作用

我有一个点击单选按钮的代码,起初我使用的是Chrome.使用以下代码:

driver.findElement(By.id("radioButton1"))).click();
Run Code Online (Sandbox Code Playgroud)

我收到了错误:

"org.openqa.selenium.WebDriverException: Element is not clickable at point (411, 675). Other element would receive the click: ..."
Run Code Online (Sandbox Code Playgroud)

做研究,我把代码更改为:

actions.moveToElement(driver.findElement(By.id("radioButton1"))).click().perform();
Run Code Online (Sandbox Code Playgroud)

现在,我正在尝试使用Internet Explorer驱动程序.但它不会执行点击.

我尝试了以下方法:

driver.findElement(By.id("radioButton1")).sendKeys(Keys.ENTER);

actions.moveToElement(driver.findElement(By.id("radioButton1"))).click().perform();

((JavascriptExecutor) driver).executeScript("arguments[0].click()", driver.findElement(By.id("radioButton1")));
Run Code Online (Sandbox Code Playgroud)

但都没有效果.第一个只关注按钮,所以我添加了另一个sendKeys,但它不起作用.第二和第三,没有任何反应.

编辑:

添加HTML代码段.

<input name="btn1" class="w-rdo-native" id="radioButton1" type="radio" value="value1" bh="RDOINP" isrefresh="false">
<label class="w-rdo w-rdo-dsize" bh="RDO"></label>
Run Code Online (Sandbox Code Playgroud)

当我点击单选按钮时,标签会在点击后获得额外的属性.

<label class="w-rdo w-rdo-dsize" bh="RDO" AWMouseDown="true"></label>
Run Code Online (Sandbox Code Playgroud)

附加编辑:

这组按钮看起来像这样:

在此输入图像描述

如前所述,一个按钮+标签块具有以下HTML结构:

<tr>
   <td>
      <div class="w-rdo-container">
          <input name="radioButtons" class="w-rdo-native" id="button1" type="radio" value="button1" bh="RDOINP" isrefresh="false">
          <label class="w-rdo w-rdo-dsize" bh="RDO">
          </label>
      </div>
  </td>
  <td class="sectionHead">Option 2
  </td>
</tr>
Run Code Online (Sandbox Code Playgroud)

单击按钮后,相应的标签将获得其他属性:

<label class="w-rdo …
Run Code Online (Sandbox Code Playgroud)

java selenium

7
推荐指数
1
解决办法
1万
查看次数

R中的数据抓取

我想使用英超联赛网站的统计数据来进行课堂项目.这是网站:https: //www.premierleague.com/stats/top/players/goals

有些过滤器允许我们按季节和其他因素进行过滤,并在页面底部有一个按钮,允许我们查看表格中的下20个条目.

我的代码如下:

library(tidyverse)
library(rvest)
url <- "https://www.premierleague.com/stats/top/players/goals?se=79"
url %>%
  read_html() %>% 
  html_nodes("table") %>% 
  .[[1]] %>% 
   html_table()
Run Code Online (Sandbox Code Playgroud)

哪个输出:

   Rank                  Player            Club         Nationality Stat
1     1            Alan Shearer               -             England  260
2     2            Wayne Rooney         Everton             England  208
3     3             Andrew Cole               -             England  187    
4     4           Frank Lampard               -             England  177
5     5           Thierry Henry               -              France  175
6     6           Robbie Fowler               -             England  163
7     7           Jermain Defoe AFC Bournemouth             England  162
8     8            Michael Owen …
Run Code Online (Sandbox Code Playgroud)

r

6
推荐指数
2
解决办法
534
查看次数

ChromeDriver - 可怕的"元素在点(x,y)处不可点击.其他元素将收到点击

我有一个网络应用程序,我正在尝试编写selenium测试,我遇到了Chrome驱动程序的问题.用户可以使用向导类型界面来填写表单.有一个按钮可以添加一行有几个设置.我用黑色概述了这一点.蓝色矩形显示按钮的可单击区域.这个矩形的中间没有重叠.

在此输入图像描述

问题是有一个巨大的div包含整个屏幕,Chrome说这个div会得到点击.那么,我该如何解决这个问题呢?这似乎不正确的行为,我不能单击此按钮,因为有一个周围的div标签.如果这是正确的行为,几乎没有任何东西可以点击.

在此输入图像描述

我想点击的按钮是这样的:

 <button id="add-thisSetting" class="btn">Add This Setting</button>
Run Code Online (Sandbox Code Playgroud)

周围的div是:

 <div class="application-tour-overlay"></div>
Run Code Online (Sandbox Code Playgroud)

这是一个缩写的html源:

<div id="editBase">
  <div class="edit-buttons application_edit_controls">
    <div id="thingamajigSettings" class="application_thingamajig_settings">
      <div id="thisSetting" class="application_thissetting application-tour-spotlit">
        <div class="control-title">This Setting
        </div>
        <div class="thisSetting-block">
          <div>
            <div class="scrolling-table" style="overflow-y: auto; overflow-x: hidden;">
              <div class="add-thisSetting-bar">
                <div class="btn-group pull-right">
                  <button id="add-thisSetting" class="btn">Add This Setting</button>
                  <button class="btn dropdown-toggle" data-toggle="dropdown">
                    <ul class="dropdown-menu">
                </div>
              </div>
            </div>
          </div>
          <div id="rulescontainer" class="application_rule_view">
            <div id="settings">
              <div class="edit-buttons application_edit_controls">
              </div>
            </div>
          </div>
          <div id="app_notify_manager" class="application_notify_manager">
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
<div class="identityOfMe-widget-ft"></div>
<div …
Run Code Online (Sandbox Code Playgroud)

java selenium-chromedriver selenium-webdriver

5
推荐指数
1
解决办法
5316
查看次数

我可以在 Selenium 运行时最小化 chrome 窗口吗?

我有一个项目要从网站获取一些信息。我想查看chrome窗口内的进程,所以我不能使用无头浏览器。但有时我想最小化镀铬窗口。

但是我发现手动最小化chrome窗口后selenium会出错,但有时不会。当出错时,异常

元素在该点不可点击,其他元素将收到点击

会提高,或者有时硒就停止。

搜索了很久有人说chrome窗口应该聚焦,不能通过点击窗口标题栏的“-”来最小化。替代解决方案是:

web.set_window_position(-2000,-2000)

使窗口移出屏幕。

还有人说通过模拟快捷键来最小化窗口。但我认为这和手动点击“-”是一样的,我错了吗?

我的问题是:

  • Selenium 真的需要 chrome 窗口不最小化吗?为什么最小化后有时可以正常运行selenium有时却不能?
  • 如果我使用

    设置窗口位置(-2000,-2000)

    要将窗口移动为不可见,然后我单击操作系统底部的窗口图标(很抱歉,我不知道它叫什么)。通常,单击时,窗口将最小化。那么对于这个chrome窗口,它会被认为是最小化窗口而出错吗?

我真的很抱歉我糟糕的英语。我希望我能清楚地描述我的问题。

环境:

  • 蟒蛇3.6
  • 铬66.0
  • 硒3.11.0
  • 视窗服务器 2012

编辑添加代码:

wait.WebDriverWait(driver,100000).until(EC.visibility_of_element_located((By.ID,'commMgrCompositionMessage')))
        textArea = driver.find_element_by_id('commMgrCompositionMessage')
        driver.execute_script("arguments[0].value="+"'"+modelStr+"';",textArea)
        time.sleep(1)
        wait.WebDriverWait(driver,10000).until(EC.presence_of_all_elements_located((By.CSS_SELECTOR,'#sendemail_label')))
        allSendMailLabel = driver.find_elements_by_css_selector('#sendemail')
        allSendMailLabel = allSendMailLabel[1]
        driver.execute_script("arguments[0].click();", allSendMailLabel)
Run Code Online (Sandbox Code Playgroud)

python selenium google-chrome

5
推荐指数
1
解决办法
3256
查看次数

元素点击拦截硒中的错误

我在测试角度站点时遇到了硒问题。

我想在此屏幕中按酒吧名称字段: 在此输入图像描述

正如您所看到的,这是打开的侧面菜单,这是 Html: 在此输入图像描述

我尝试等待该元素可点击,并且它通过了。这是我的代码:

public static void insertPublisherName(String publisherName)
    {
      //  BasePage.manuallyKeyboardPressing(Keys.ESCAPE);
      //  Logger.info("\n ******************* insert publisher name by Xpath: "+ COMPANY_NAME_XPATH +" *\n **************************************************\n");
      //  BasePage.inputValueByXpath(publisherName,COMPANY_NAME_XPATH);
        WebDriver driver2 = WebDriverMgr.getDriver();
        driver2.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);
        WebDriverWait wait = new WebDriverWait(driver2,58);
        wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//input[@formcontrolname='publisher_name']")));

        WebElement element = driver2.findElement(By.xpath("//input[@formcontrolname='publisher_name']"));
        element.click();
        element.clear();
        element.sendKeys("123465");


    }
Run Code Online (Sandbox Code Playgroud)

这是例外:

:ERROR: element click intercepted: Element <input _ngcontent-xni-c24="" autocomplete="off" formcontrolname="publisher_name" nz-input="" placeholder="Enter Publisher Name" class="ant-input ng-untouched ng-pristine ng-valid" ng-reflect-name="publisher_name"> is not clickable at point (1560, 116). Other element would receive the click: …
Run Code Online (Sandbox Code Playgroud)

selenium selenium-chromedriver angular

5
推荐指数
1
解决办法
2万
查看次数

Browser.wait()直到.getAttribute()返回true

我还在学习Protractor所以我不确定这是否是一个我没有得到的简单答案,但我只是想让浏览器等到我正在检索的属性为真.

我正在测试这个网站的披萨选项.

完整代码:

browser.get('https://material.angularjs.org/latest/#/demo/material.components.select');

var topping = element(by.model('topping'));

topping.click();

browser.wait(function() {
    return topping.getAttribute('aria-expanded').then(function(value) {
        return value == 'true';
    });
}, 5000);

var toppingOptions = element.all(by.css('[role="option"]'));

toppingOptions.get(5).click();

expect(topping.getText()).toBe('Onion');
Run Code Online (Sandbox Code Playgroud)

这给了我错误:

元素在点(436,693)处不可点击.其他元素将收到点击:<md-backdrop class="md-select-backdrop md-click-catcher md-default-theme"></md-backdrop>

还要说明一点,如果我把browser.sleep(1000);topping.click()和之前browser.wait()再测试通过.所以我知道测试的其余部分并不是失败的.由于某种原因,等待的呼叫不起作用.

我认为它可能与我点击的选项在点击时在技术上不可见这一事实有关,topping因为它在带有滚动元素的ComboBox中.如果有人知道模拟滚动到"洋葱"元素的好方法,那么也会非常感激.

javascript testing selenium angularjs protractor

4
推荐指数
1
解决办法
4184
查看次数

点击菜单链接时,获取元素不是可点击的例外

我想点击菜单链接但没有运气.它总是显示异常 -

线程"main"中的异常org.openqa.selenium.WebDriverException:未知错误:元素在点(64,64)处不可点击.其他元素将收到点击:<div style ="position:absolute; left:0px; top:0px; width:100%; height:100%; z-index:30; background-color:rgb(221,221, 221);不透明度:0.4;">

我有以下 html片段

<div id="RWR" class="clsDesktopHome" style="position: absolute; left: 0px; right: 0px; top: 0px; bottom: 0px; overflow: auto;">
    <div class="clsDesktop clsDesktopHomePage" style="width: 1553px; height: 430px; top: 0px; left: 15px;">
        <div id="foid:2" class="clsDesktopHeader clsTextOnDesktopColor">
            <div id="foid:1" class="clsDesktopTabs" style="margin-right: 230px; height: 28px; visibility: visible; width: auto;">
                <span class="clsDesktopTab clsDesktopTabActive clsDesktopTabTypeHome clsDesktopTabTypeHomeActive">
                    <span class="clsDesktopTabContent">
                        <span class="clsDesktopTabTypeIcon"></span>
                        <span class="clsDesktopTabMenuIcon"></span>
                        <span class="clsDesktopTabCollaborationIcon"></span>
                        <span class="clsDesktopTabCaption">Home</span>
                        <span class="clsDesktopTabCloseIcon"></span>
                    </span>
                </span>
                <span class="clsDesktopTab clsDesktopTabInactive clsDesktopTabCanClose clsDesktopTabTypeSheet"> …
Run Code Online (Sandbox Code Playgroud)

java selenium selenium-webdriver

3
推荐指数
1
解决办法
1468
查看次数

元素不可点击,因为另一个元素在 python 中遮住了它

我正在尝试自动化接入点 Web 配置。在此期间,我会弹出一个窗口(类似于“是”和“否”的叠加层),我想点击它

我试图点击的叠加层的 HTML 代码:

<div id="generic-warning-dialog" class="dialog exclamation text-orphan" style="">
<div class="warning-content dialog-content text-orphan">Security Mode is disabled on one or more of your wireless networks. Your network could be open to unauthorized users. Are you sure you wish&nbsp;to&nbsp;proceed?</div>
    <div class="dialog-buttons text-orphan">
        <button class="cancel">No</button>
        <button class="submit" style="display: block;">Yes</button>
    </div>
</div> 
Run Code Online (Sandbox Code Playgroud)

我试过

browser.find_element_by_class_name("submit").click()
Run Code Online (Sandbox Code Playgroud)

但我收到以下错误:

引发 exception_class(message, screen, stacktrace) selenium.common.exceptions.ElementClickInterceptedException:消息:元素在点 (788,636.5) 处不可点击,因为另一个元素遮住了它

你能告诉我应该如何进行吗?我正在使用火狐和蟒蛇

python firefox selenium ui-automation

3
推荐指数
2
解决办法
2万
查看次数