Find page elements and navigatio

2017-05-30  本文已影响0人  cutelittlePanda

.. to a link: driver.get("link_url")

.. interacting with the page, find elements: 

1. find one:  find_element_by_xx.....

2. find more: find_elements_by_xx...

            use:  for element_name in all_elements_found: 

                            print("Value is: %s", element_name.get_attribute("value"))

             to output the values.

.. driver.switch_to_fram("iframe_name")

..drag_and_drop:    from selenium.webdriver import ActionChains

                                action_chains = ActionChains(driver)

                                 action_chains.drag_and_drop(element, target).perform()

.. driver.switch_to_window("window_name")

.. driver.switch_to_frame("frameName.0.childName"):

                                         would go to the frame named “childName” of the first subframe of the frame called “frameName”. All frames are evaluated as if from *top*.

.. Back to the parent frame:  driver.switch_to_default_content()

3. Frequently used methods

上一篇下一篇

猜你喜欢

热点阅读