Skip to content

Instantly share code, notes, and snippets.

Last active Apr 17, 2019
What would you like to do?

Welcher Selemium Selektor findet das 2. div?

    <div class="hidden" id="foo">
        Ich bin unsichtbar.

    <div id="foo">
        Hallo Robot

Lösung: xpath=//div[@id="foo"][2] oder besser xpath=//div[@id="foo" and contains(text(), "Robot")]

Was passiert und wie kann ich das gewünschte Verhalten erreichen?

<!-- Modal HTML embedded directly into document -->
    <div id="ex1" class="modal">
        <p>Thanks for clicking. That felt good.</p>
        <a href="#" rel="modal:close">Close</a>

    <!-- Link to open the modal -->
    <p><a href="#ex1" rel="modal:open">Open Modal</a></p>

    <button type="button" id="clickme">Click me!</button>

Test Overlay Element | FAIL | WebDriverException: Message: unknown error: Element ... is not clickable at point (43, 123). Other element would receive the click:

(Session info: chrome=62.0.3202.94) (Driver info: chromedriver=2.33.506120 (e3e53437346286c0bc2d2dc9aa4915ba81d9023f),platform=Windows NT 10.0.15063 x86_64)

Lösung: Modal schliessen, und Button clicken

Wie kann ich das Element mit dem Selektor css=#info .msg clicken?

<!DOCTYPE html>

<html lang="en" xmlns="">
    <meta charset="utf-8" />
    <title>Delay Test</title>
    <script src="../dist/js/jquery-3.2.1.min.js"></script>
    <script type="text/javascript">

        function delayedInsert() {
            $('#info').append("<span class='msg'>Hallo Robot</span>")

        $(document).ready(function () {
                click: function () {
                    window.setTimeout(delayedInsert, 6000);

    <h1>Delay Test</h1>

    <input type="button" value="Sag Hallo ..." name="hallo"  />
    <div id="info"></div>

  • Lösung 1: Sleep 6
  • Lösung 2: Set Selenium Timeout 10
  • Lösung 3 (die beste): Wait Until Element is Visible css=.msg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment