我正在尝试使用selenium c#复制和粘贴对象,键盘操作,它适用于Ctrl + c但不适用于Ctrl + v。
以下示例脚本:
Action copyAction = GetActions();
Action pasteAction = GetActions();
copyAction.SendKeys(Keys.Control + "c").Build().Perform();
Now click a folder to paste above copied object
Thread.Sleep(1000);
pasteAction.SendKeys(Keys.Control + "v").Build().Perform();
先谢谢。
答案 0 :(得分:0)
此代码适合我!它允许我将它与Sendkeys一起使用
Clipboard.SetText(target);
PageObjects.SendKeys(OpenQA.Selenium.Keys.Control + "v");
答案 1 :(得分:0)
class TypeBaseSerializer(serializers.Serializer):
# you will have to re-declare fields here since this is not a ModelSerializer
name = serializers.CharField()
id = serializers.CharField()
other_field = serializers.SerializerMethodField()
class Meta:
fields = ['id', 'name', 'other_field']
def get_other_field(self, instance):
# will be available on child classes, which are children of ModelSerializers
return instance.other_field
KeyDown():当需要按下特定的键盘按键时,此方法模拟键盘操作。
KeyUp():使用KeyDown()方法按下的键盘键不会自动释放,因此使用keyUp()方法显式释放键。
SendKeys():此方法将一系列击键发送到给定的Web元素。