I am new to selenium and need some clarification on some stuff. I've tried click
and clickAndWait
in the IDE, and while the references stated clearly what each meant, when I export the test case to Python, it seems like both are doing the same thing here
driver.find_element_by_xpath("//li[@id='pa-u_8298348-bd']/a/span[2]").click() #click and wait
driver.find_element_by_link_text("IMVironments").click() #click
Can someone tell me what is the difference here then?
From Selenium docs:
Many Actions can be called with the "AndWait" suffix, e.g. "clickAndWait". This suffix tells Selenium that the action will cause the browser to make a call to the server, and that Selenium should wait for a new page to load.
2 years later, I know. But I was looking for the same answer and found it.
From the Selenium Wiki
The AndWait alternative is always used when the action causes the browser to navigate to another page or reload the present one.
In other words, Selenium's webdriver, when utilizing the Click() command, will inherently use the "AndWait" modifier if it recognizes a page load.
See also Interface WebElement
void click()
Click this element. If this causes a new page to load, this method will attempt to block until the page has loaded.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With