0

셀레늄 webdrive를 사용하여 드롭 다운 목록에서 항목을 선택합니다.org.openqa.selenium.WebDriverException : 알 수없는 오류 : 요소를 클릭 할 수 없음

내가 "game club" 요소 내가 몇 가지 요소를 시도

을 클릭합니다,하지만 난 그 비는 클릭 할 수 있다는 오류가 발생

enter image description here

enter image description here

.

org.openqa.selenium.WebDriverException: unknown error: Element is not clickable at point (790, 227). Other element would receive the click: <div id="select2-drop-mask" class="select2-drop-mask" style=""></div> 
(Session info: chrome=41.0.2272.3) 

그러나, 브라우저를 사용하여 나는 확실히 항목을 클릭합니다.

어떻게하면이 항목을 클릭 할 수 있습니까?

+0

이 링크가 도움이 될 수 있음 ... http://stackoverflow.com/questions/11908249/debugging-element-is-not-clickable-at-point-error/19419366#19419366 –

답변

0

정적 목록 인 경우 SelectElement(IWebElement element) 메서드를 사용합니다.

C# 예 :

var dropDown = _webDriver.FindElement(By.ClassName("select2-result-sub")); 
    var dropDownSelector = new SelectElement(dropDown); 
    dropDownSelector.SelectByIndex(3); 
0

당신이 시도 할 수 있습니다 : (예를 들어)이 사용 후

public void click(By element) { 
    WebElement button = driver.findElement(element); 
    try { 
     button.click(); 
    } catch (WebDriverException e) { 
     List<WebElement> availables = button.findElements(By.tagName("div")); 
     availables.addAll(button.findElements(By.tagName("span"))); 
     tryClick(availables); 
    } 
} 

public void tryClick(List<WebElement> availables) { 
    for (WebElement candidate : availables) { 
     try { 
      candidate.click(); 
      return; 
     } catch (WebDriverException e) { 
      continue; 
     } 
    } 
} 

:

click(By.id("elementId")); 

관해서!

관련 문제