3 element and browser operation method

Operation method of element and browser

1 Common operation method of element

clear() Clear the text
send_keys() Analog input
click() Click the element

2 WebDriver common methods for operating browsers< /h3>

# Maximize the browser driver.maximize_window()# Refresh driver.refresh()# Back driver.back()# Forward driver.forward()# Set browser size driver.set_window_size (300,300)# Set the browser position driver.set_window_position(300,200)# Close a single window of the browser driver.close()# Close all windows of the browser driver.quit()

3 Other common methods of WebDriver

# Get the user name text box size size=driver.find_element_by_id("userA").sizeprint('size:',size)# Get the content of a tag text=driver.find_element_by_id("fwA").textprint('atag text:',text)# Get titletitle=driver.titleprint('title:',title)# Get the current page urlurl=driver.current_urlprint('url: ',url)# Get the href attribute value of a tag href=driver.find_element_by_id("fwA").get_attribute("href")print('href attribute value:',href)# Determine whether the span is displayed display=driver.find_element_by_css_selector ('span').is_displayed()print('Whether the span label is displayed:',display)# Determine whether the cancel button is available nabled=driver.find_element_by_id('cancelA').is_enabled()print('Is the cancel button available:',enabled) Execution result: size: {'height': 30,'width': 163}a label text: visit Sina Website title: Register Aurl:file:///E:/%E6%B5%8B%E8%AF%95/%E8%AF%BE%E4%BB%B6/Web%E8%87%AA%E5% 8A%A8%E5%8C%96/Web%E8%87%AA%E5%8A%A8%E5%8C%96%E8%AF%BE%E4%BB%B6/02img/%E6%B3%A8 %E5%86%8CA.htmlhref attribute value: http://www.sina.com.cn/span whether the label is displayed: False is the cancel button available: False

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 453 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.