【问题标题】:Coded UI - Keyboard.sendkeys - Sending path of a file containing special characters编码 UI - Keyboard.sendkeys - 发送包含特殊字符的文件的路径
【发布时间】:2016-08-15 23:36:31
【问题描述】:

我正在尝试使用 codedui 中的 keyboard.sendkeys 发送包含特殊字符的文件的路径(动态):

string filepath="I:\^abc\abc\filename.csv";
Keyboard.SendKeys(filepath);

由于某种原因,文件路径中的 ^abc 被视为特殊字符,而 sendkeys 没有发送它。

是否有解决此问题的方法或有效的方法?我基本上是在选择一个 windows 文件,即通过 windows 提示符。

【问题讨论】:

    标签: c# visual-studio-2015 coded-ui-tests qtp


    【解决方案1】:

    根据docs,^ 是修饰符。在字符将其作为控制键组合发送之前添加它。例如,“^a”将发送 CTRL+A。

    尝试将“^”包裹在大括号中,像这样,以逃避它:

    string filepath="I:\{^}abc\abc\filename.csv";
    

    【讨论】:

    • 太棒了。乐于助人。:) ?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2022-12-03
    • 2022-10-18
    • 2018-03-13
    • 2013-02-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多