使用TextAngular爲AngularJS/ Rails
環境中的富文本輸入框。水豚一體化測試'TextAngular'輸入
運行集成測試Capybara/Selenium & Capybara-Webkit
。 試圖創建一個集成測試,將文本輸入文本區域進行測試。但是,我無法成功地做到這一點。
阻止我的事情是文本輸入框ID在測試加載或頁面加載時發生變化。所以我使用了下面的類,它在文本角度測試中使用。隨着:
find('textarea.ta-html.ta-editor')
我用這個,因爲我知道它的作品和JavaScript測試書面文字角使用此。 text angular github tests
然而,當我試着和文本值設置文本區域:
find('textarea.ta-html.ta-editor').set("Upgraded to SSD")
我得到:
Failure/Error: find('textarea.ta-html.ta-editor').set("Upgraded to SSD")
Selenium::WebDriver::Error::ElementNotVisibleError: Element is not currently visible and so may not be interacted with
如何設置使用Capybara
文本區域的值?
湯姆燦爛和乾淨的解決方案。可以使用Capybara/Selenium設置文本:find('div.ta-text.ta-editor div [contenteditable]')。set(「Upgraded to SSD」) – orion