selenium随笔

selenium随笔,第1张

概述1、使用selenium中的webdriver模块对浏览器进行 *** 作   1)b = webdriver.Firefox()   #打开浏览器   2)b.get(‘http://www.baidu.com‘)  #打开一个网页       判断url,title找到元素方式   3)b.title,current_url 判断访问是否有效   4) ele = find_element_by_id

1、使用selenium中的webdriver模块对浏览器进行 *** 作

  1)b = webdriver.firefox()   #打开浏览器

  2)b.get(‘http://www.baIDu.com‘)  #打开一个网页

      判断url,Title找到元素方式

  3)b.Title,current_url 判断访问是否有效

  4) ele = find_element_by_ID/name()  #定位元素

  5)ele.clear()  ele.send_keys()  清空和输入

  6)b.back()  #back

 

2、webdriver模块对浏览器进行 *** 作:元素的定位

  7)ele = find_element_by_link_text(‘企业直通班’)

  8)ele = find_element_by_partial_link_text(‘直通班’)

  9)ele = find_element_by_CSS_selector(‘input[ID=\‘search\‘]‘)

     ele = find_element_by_CSS_selector(‘img[alt="麦子学院三周年"]’)

  10)xpath定位文件:/  //  .  ..  @ID  count

    ele = find_element_by_xpath(‘//input‘)

    ele = find_element_by_xpath(‘//input[0]‘)

    ele = find_element_by_xpath(‘//form//input[0]‘)

    ele = find_element_by_xpath(‘//form//input/..‘)

     find_element_by_xpath(‘//input[@ID]‘)

    find_element_by_xpath(‘//input[@name="firstname"]‘)

    find_element_by_xpath(‘//*[count(input)=2]‘)

总结

以上是内存溢出为你收集整理的selenium随笔全部内容,希望文章能够帮你解决selenium随笔所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1072453.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-26
下一篇 2022-05-26

发表评论

登录后才能评论

评论列表(0条)

保存