硒等待可点击-元素点击被拦截的问题

时间:2019-10-27 12:17:42

标签: selenium selenium-webdriver selenium-chromedriver webdriverwait

我在等待硒方面遇到问题。 我想按一个元素并获取有关拦截的错误。 我尝试了所有解决方案,例如element is wait element都是可单击的,等等,但是没有任何效果。

如何解决此异常,并告诉硒等待该元素将被删除/不可见/消失了?

useEffect

我只希望硒等待直到可以单击,然后可以按元素。 我该如何克服?因为没有获得点击的元素的ID而不是仅获得类的

function Field(props) {
  const { name, label, initialValue, onChange } = props;
  const [value, setValue] = React.useState(initialValue);

  useEffect(() => {
    setValue(initialValue);
  }, [initialValue]);

  return ...
}

可以更改       (会话信息:chrome = 78.0.3904.70)

1 个答案:

答案 0 :(得分:0)

请更新您的代码。

尝试使用Actions类:

gawk -v old="$old_text" -v new="$new_text" -v RS="^$" -i inplace '   ##Starting gawk program here mentioning variable named old whose value is of value of shell variable named old_text.
                                                                     ##New variable has new_text shell variable value in it. Now Setting RS(record separator as ^$) to make all lines to be treated as a single one.
{                                                                    ##Starting main BLOCK  here.
  found=index($0,old)                                                ##using index function of awk which will provide index number of ay provided variable, here we want to know index(starting point) of variale old and saving it into found awk variable.
}
found{                                                               ##Checking condition if vriable found is NOT NULL then do following.
  print substr($0,1,found) new substr($0,found+length(old)+1)        ##Printing substring from line 1st character to till index of variable old then printing new variable and again printing sub-string which will basically print everything after old variable, nothing should be removed unnecessarily.
  found=""                                                           ##Nullifying found variable here.
  next                                                               ##next will skip all further statements from here.
}                                                                    ##Closing main BLOCK here.
'  Input_file                                                        ##Mentioning Input_file name here.
  1. 元素不在视口中而未被点击

尝试使用JavascriptExecutor将元素带入视口:

WebElement element = driver.findElement(By.id("header-account"));
Actions actions = new Actions(driver);
actions.moveToElement(element).click().build().perform();
相关问题