多测师是一家拥有先进的教学理念,强大的师资团队,业内好评甚多的接口自动化测试培训机构!

17727591462

联系电话

您现在所在位置:接口自动化测试培训 > 新闻资讯

selenium-webdriver(python)—send_keys()输入中文运行报错问题

更新时间:2022-05-16 09:12:54 作者:多测师 浏览:91

  selenium2 python在send_keys()中输入中文一直报错,其实前面加个小u 就解决了:

  send_keys(u"输入中文")

  基本上键盘上所有的按键都可以模拟

selenium-webdriver(python)—send_keys()输入中文运行报错问题

  module:selenium.webdriver.common.keys

  • class Keys()

  – NULL = u’ue000’

  – CANCEL = u’ue001’ # ^break

  – HELP = u’ue002’

  – BACK_SPACE = u’ue003’

  – TAB = u’ue004’

  – CLEAR = u’ue005’

  – RETURN = u’ue006’

  – ENTER = u’ue007’

  – SHIFT = u’ue008’

  – LEFT_SHIFT = u’ue008’ # alias

  – CONTROL = u’ue009’

  – LEFT_CONTROL = u’ue009’ # alias

  – ALT = u’ue00a’

  – LEFT_ALT = u’ue00a’ # alias

  – PAUSE = u’ue00b’

  – ESCAPE = u’ue00c’

  – SPACE = u’ue00d’

  – PAGE_UP = u’ue00e’

  – PAGE_DOWN = u’ue00f’

  – END = u’ue010’

  – HOME = u’ue011’

  – LEFT = u’ue012’

  – ARROW_LEFT = u’ue012’ # alias

  – UP = u’ue013’

  – ARROW_UP = u’ue013’ # alias

  – RIGHT = u’ue014’

  – ARROW_RIGHT = u’ue014’ # alias

  – DOWN = u’ue015’

  – ARROW_DOWN = u’ue015’ # alias

  – INSERT = u’ue016’

  – DELETE = u’ue017’

  – SEMICOLON = u’ue018’

  – EQUALS = u’ue019’

  – NUMPAD0 = u’ue01a’ # numbe pad keys

  – NUMPAD1 = u’ue01b’

  – NUMPAD2 = u’ue01c’

  – NUMPAD3 = u’ue01d’

  – NUMPAD4 = u’ue01e’

  – NUMPAD5 = u’ue01f’

  – NUMPAD6 = u’ue020’

  – NUMPAD7 = u’ue021’

  – NUMPAD8 = u’ue022’

  – NUMPAD9 = u’ue023’

  – MULTIPLY = u’ue024’

  – ADD = u’ue025’

  – SEPARATOR = u’ue026’

  – SUBTRACT = u’ue027’

  – DECIMAL = u’ue028’

  – DIVIDE = u’ue029’

  – F1 = u’ue031’ # function keys

  – F2 = u’ue032’

  – F3 = u’ue033’

  – F4 = u’ue034’

  – F5 = u’ue035’

  – F6 = u’ue036’

  – F7 = u’ue037’

  – F8 = u’ue038’

  – F9 = u’ue039’

  – F10 = u’ue03a’

  – F11 = u’ue03b’

  – F12 = u’ue03c’

  – META = u’ue03d’

  – COMMAND = u’ue03d’

  以上内容为大家介绍了自动化测试中的selenium-webdriver(python)—send_keys()输入中文运行报错问题,本文由多测师亲自撰写,希望对大家有所帮助。了解更多自动化测试相关知识:https://www.aichudan.com/xwzx/

联系电话

17727591462

返回顶部