How do I get dynamic div content in selenium



  • enter image description here

    See how the dynamic message displays in the browser. I am adding a name in a text field and clicking save button. After clicking save, a message displays as New Staff added or Staff Name already exists!. I want to get the content of the message. Based on the content I want to proceed with my testcase or end it. How can this be done using selenium?



  • What you are trying to test feels like pretty basic automated web testing.

    1. Do some action
    2. Wait for new element to appear
    3. Verify content of element

    Without the actual HTML its hard for anyone to assist you with identifying the element. Elements are identified in Selenium with different type of selectors.

    I think the best advice I can give you is to get better (web testing) knowledge:

    1. Learn HTML and CSS so you understand the structure of the websites/applications, follow the free online course on Codecademy.
    2. Follow Selenium tutorials to understand basic element finding
    3. Read a good Selenium book


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2