2017-11-17 7 views
0

나는 링크와 텍스트를 클릭 할 수 있었다 그러나 나는 안드로이드 Appium와 크롬을 사용하여 버튼에Android Appium Chrome 버튼 클릭 또는 탭하지 않습니까?

public void testcheck() { 
    System.out.println("Select"); 
    //<a id="vivKo" href="javascript:void(0);" class="btn btn- green vivKo at_vivKo"> 
    //<span class="text">vivKo</span> 
    // <i class="fa fa-chevron-right"></i> </a> 
    //driver.findElementByXPath("//span[contains(., \"" + vivKo + "\")]").click(); 
    WebElement vova = (WebElement) driver.findElementByXPath("//*[@id=vivKo']"); 
    TouchAction ta = new TouchAction(driver); 
    ta.longPress(vova); 
    //WebElement vova = (WebElement) driver.findElementByXPath("//*[@id='vivKo']"); 
    driver.findElement(By.xpath("//*[@id='vivKo']")).click(); 
    WebElement elementToClick = driver.findElement(By.xpath("//*[@id='vivKo']")); 
    Actions actions = new Actions(driver); 
    new WebDriverWait(driver, 60).until(ExpectedConditions.visibilityOf(vova)); 
    actions.moveToElement(elementToClick).click().build().perform(); 

오류를 클릭 할 수 없습니다 : 당신이 요소가이 아니라는 것을 알고있는 경우

org.openqa.selenium.WebDriverException: unknown error: Element is not clickable at point (180, 630) 
(Session info: chrome=62.0.3202.84) 
(Driver info: chromedriver=2.30.477690 (c53f4ad87510ee97b5c3425a14c0e79780cdf262),platform=Mac OS X 10.12.6 x86_64) (WARNING: The server did not provide any stacktrace information) 
Command duration or timeout: 237 milliseconds 
Build info: version: '2.52.0', revision: '4c2593cfc3689a7fcd7be52549167e5ccc93ad28', time: '2016-02-11 11:22:43' 
System info: host: 'AMAC02T90QRGTFM', ip: '192.168.14.180', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.12.6', java.version: '1.8.0_144' 
Driver info: io.appium.java_client.android.AndroidDriver 
Capabilities [{deviceScreenSize=1440x2960, networkConnectionEnabled=true, warnings={}, databaseEnabled=false, deviceName=9887fc35525a485333, platform=LINUX, deviceUDID=9887fc35525a485333, desired={platformVersion=7.0, browserName=Chrome, platformName=Android, deviceName=Vovchik}, platformVersion=7.0, webStorageEnabled=false, locationContextEnabled=false, takesScreenshot=true, browserName=Chrome, javascriptEnabled=true, deviceModel=SM-G950U, platformName=Android, deviceManufacturer=samsung}] 
Session ID: 10923751-6fb6-48d1-b61d-50be29f84770 
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) 
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) 
at 
+0

[Selenium Web Driver & Java와 중복 될 수있는 요소를 클릭 할 수 없습니다.]가 표시됩니다. 포인트 (36, 72)에서 요소를 클릭 할 수 없습니다. 다른 요소는 클릭을 받게됩니다.] (https://stackoverflow.com/questions/44912203/selenium-web-driver-java-element-is-not-clickable-at-point-36-72-other-el) – DebanjanB

+0

감사! 어떻게 scroll down()이 작동하지 않는지 아래로 스크롤 해 보겠습니다. –

답변

0

을 testcheck : 실패 화면에 표시되지만 드라이버를 통해 가져올 수있는 경우 클릭하기 전에 스 와이프 (예 : 100 픽셀) 할 수 있습니다.

int x = element.getLocation().getX(); 
int y = element.getLocation().getY(); 
new TouchAction(driver) 
    .press(x, y) 
    .waitAction(ofMillis(500)) 
    .moveTo(x, y+100) 
    .release() 
    .perform(); 

물론 정확한 화면 이동 크기를 계산할 수 있습니다.