有时候我们定位元素时,会发现该元素的属性无id,无name,这时就需要考虑其他的定位方式,比如对class属性进行定位
1.class属性值中间没有空格时
使用robot定位方式如下:
在eclipse中python脚本如下:
chrome.find_element_by_class_name('form-control').send_keys('998866')
2.class属性值中间有空格时
在robot中定位方式如下
在eclipse中python脚本如下:
chrome.find_element_by_css_selector('button.btn.btn-primary').click()