1.打开页面
打开页面,使用I.amOnPage(),如果URL不是以http://或者https://开始的,就则将其视为相对URL,并将其附加到配置文件 codecept.conf.js 中设置的URL后面
2.点击页面元素
单击定位器提供的链接或按钮。如果给出了模糊定位符,则会在页面上搜索与定位符字符串匹配的按钮,链接或图像。对于按钮,将搜索“值”属性,“名称”属性和内部文本。对于链接,将搜索链接文本。对于图像,将搜索“ alt”属性和任何父链接的内部文本。
第二个参数是上下文(CSS或XPath定位器),以缩小搜索范围。
I.click('/html/body/div/div/div[2]/div/div[2]/div[2]/div[2]/div/div/ul/li[1]/div/div[2]/div/a')
I.click({css:'button, html [type="button"], [type="reset"], [type="submit"]'})
I.click('CRM','.ant-list-item-meta-description a')
|
3.输入框输入
I.fillField('.ant-input-affix-wrapper .ant-input:not(:first-child)', '13500000000');
I.fillField('//*[@id="root"]/div/div[2]/div/div/div/div/form/div[1]/div/div/span/span/input')
I.fillField({css: '.ant-input-affix-wrapper .ant-input:not(:first-child)'}, '13500000000');
|
4.下拉框选项
4.React定位
{ react: 'MyComponent' }
{ react: 'Button', props: { title: 'Click Me' }}
{ react: 'Button', state: { some: 'state' }}
{ react: 'Input', state: 'valid'}
I.click({react: 'button', props: { type: 'button',class: 'ant-btn ant-btn-primary',style :' 100%; height: 36px;' }})
|
5.断言
5.1 see
I.see('CRM','.ant-list-item-meta-description a')
I.see('CRM',{css: '.ant-list-item-meta-description a'})
|
5.2 seeAttributesOnElements
5.3 seeCookie
6.等待
7.按键
支持的特殊键名
Some of the supported key names are:
'AltLeft' or 'Alt'
'AltRight'
'ArrowDown'
'ArrowLeft'
'ArrowRight'
'ArrowUp'
'Backspace'
'Clear'
'ControlLeft' or 'Control'
'ControlRight'
'Command'
'CommandOrControl'
'Delete'
'End'
'Enter'
'Escape'
'F1' to 'F12'
'Home'
'Insert'
'MetaLeft' or 'Meta'
'MetaRight'
'Numpad0' to 'Numpad9'
'NumpadAdd'
'NumpadDecimal'
'NumpadDivide'
'NumpadMultiply'
'NumpadSubtract'
'PageDown'
'PageUp'
'Pause'
'Return'
'ShiftLeft' or 'Shift'
'ShiftRight'
'Space'
'Tab'
|