2014-03-03 1 views

답변

0

로봇을 사용할 필요가 없습니다. 셀렌을 사용하십시오.

driver.findElement(By.id("username")).clear(); 

http://selenium.googlecode.com/svn/trunk/docs/api/java/org/openqa/selenium/WebElement.html#clear()

+1

을 : // 코드를 .google.com/p/robotframework /) (키워드 기반 셀레늄 래퍼) –

+0

아마도 @ ErrM이 맞을 것입니다. 셀레늄이'#clear()'를 가지고있을 때 사용하지 않아도된다. :) – sircapsalot

+0

그는 이것을하기 위해 로봇 프레임 워크를 사용하지 않고있다. 그는 Robot 프레임 워크에서 어떻게해야하는지 질문했습니다. 대답 사용 키워드 지우기 요소 텍스트 사용 http://robotframework.org/Selenium2Library/Selenium2Library.html#Clear%20Element%20Text – ManiG

2

또한 명확한 테스트 필드에 이것을 사용할 수 있습니다 ..

driver.findElement(By.id("textfieldid")).sendKeys("");//empty string

또는

Input Text (your web element locator) ${empty}

0

당신은 필요하지 않습니다. Check here

def input_text(self, locator, text): 
    """Types the given `text` into text field identified by `locator`. 
     See `introduction` for details about locating elements. """ 
     self._info("Typing text '%s' into text field '%s'" % (text, locator)) 
     self._input_text_into_text_field(locator, text) 

Input Text 키워드 어쨌든 분명한 명령을 보내는

_input_text_into_text_field 

호출 : 그는 아마 [로봇 프레임 워크 (HTTPS 대해 이야기

def _input_text_into_text_field(self, locator, text): 
    element = self._element_find(locator, True, True) 
    element.clear() 
    element.send_keys(text)  
+0

라이브러리를 실행할 때 "ImportError : No keywordgroup keywordgroup"오류가 발생합니다. @ Errki M – user3375048

+0

user @ user3283976에 의해 제안 된 해결책이 효과가 있다고 생각합니다. 빈 문자열로 Input Text 키워드를 실행 중입니다. 내가 말한 것은 키를 보내기 전에 텍스트 필드를 지우고 싶다면 Input Text 키워드가 이미 그것을 처리하고 있기 때문에 텍스트 필드를 지울 필요가 없다는 것입니다. –

+0

이제이 입력 텍스트를 사용할 때 "StaleElementReferenceException"오류가 발생합니다. * [@ name = 'resolution'] 편집. – user3375048