Similar to hover_and_click(), but assumes top element is already found.
(
driver,
element,
click_selector,
click_by="css selector",
timeout=settings.SMALL_TIMEOUT,
)
| 322 | |
| 323 | |
| 324 | def hover_element_and_click( |
| 325 | driver, |
| 326 | element, |
| 327 | click_selector, |
| 328 | click_by="css selector", |
| 329 | timeout=settings.SMALL_TIMEOUT, |
| 330 | ): |
| 331 | """ |
| 332 | Similar to hover_and_click(), but assumes top element is already found. |
| 333 | """ |
| 334 | _reconnect_if_disconnected(driver) |
| 335 | start_ms = time.time() * 1000.0 |
| 336 | stop_ms = start_ms + (timeout * 1000.0) |
| 337 | hover = ActionChains(driver).move_to_element(element) |
| 338 | for x in range(int(timeout * 10)): |
| 339 | try: |
| 340 | hover.perform() |
| 341 | element = driver.find_element(by=click_by, value=click_selector) |
| 342 | element.click() |
| 343 | return element |
| 344 | except Exception: |
| 345 | now_ms = time.time() * 1000.0 |
| 346 | if now_ms >= stop_ms: |
| 347 | break |
| 348 | time.sleep(0.1) |
| 349 | plural = "s" |
| 350 | if timeout == 1: |
| 351 | plural = "" |
| 352 | message = "Element {%s} was not present after %s second%s!" % ( |
| 353 | click_selector, |
| 354 | timeout, |
| 355 | plural, |
| 356 | ) |
| 357 | timeout_exception(NoSuchElementException, message) |
| 358 | |
| 359 | |
| 360 | def hover_element_and_double_click( |
nothing calls this directly
no test coverage detected
searching dependent graphs…