如何附加到水豚(Webdriver)中的字段,而不是清除并填充 [英] How to append to a field in Capybara (Webdriver) rather than clear and populate

查看:96
本文介绍了如何附加到水豚(Webdriver)中的字段,而不是清除并填充的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是水豚的新手。我使用的是WebDriver驱动程序,我想附加到字段值上,而不是覆盖全部内容。



当我使用方法fill_in时,它将覆盖整体价值(先清除然后填充)。但是我只想在字段中附加一个现有值。

解决方案

看起来像 send_keys 将是您的朋友。 / p>

尝试 find_field('您的字段').native.send_keys('某些文本')


I'm a newbie to Capybara. I'm using the WebDriver driver and I would like to append to a field value as opposed to overwrite the entire contents.

When I use the method fill_in, it overwrites the whole value (clears and then populates). However I want to just append to an existing value in the field.

解决方案

Looks like send_keys will be your friend.

Try find_field('Your field').native.send_keys('some text')

这篇关于如何附加到水豚(Webdriver)中的字段,而不是清除并填充的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆