Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. QA Tools
  3. Squish
  4. Check CSS pseudo elements with squish web API

Check CSS pseudo elements with squish web API

Scheduled Pinned Locked Moved Unsolved Squish
2 Posts 2 Posters 1.0k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Rino
    wrote on last edited by
    #1

    Hi,
    how can I check the CSS pseudo elements (::after, ::before) of a HTML object?

    Thanks

    1 Reply Last reply
    0
    • H Offline
      H Offline
      henry.ishiyama
      wrote on last edited by
      #2

      You can execute JavaScript code with "evalJS" function.

      Following is an example, if you want to get the content of the element created by "::after" CSS pseudo element,

      ~ Squish script in Python ~
      tmp = evalJS(f'let tmp = window.getComputedStyle(document.getElementsByClassName("ribbon")[0], "::after").content; tmp')
      test.log(f'{tmp}')
      ~ Squish script in Python ~
      
      
      ~ Associated HTML code ~
      <html>
          <head>
              <title>Test</title>
              <style>
                  .ribbon::after {
                      content: "This is a content added by ::after of CSS pseudo element.";
                      background-color: #ffba10;
                      border-color: black;
                      border-style: dotted;
                  }
              </style>
          </head>
          <body>
              <p class="ribbon">Look at the orange box after this text. </p>
          </body>
      </html>
      ~ Associated HTML code ~
      

      NOTE :
      For more information regarding "evalJS" function and its usage, please refer to our following documentation.

      https://doc.qt.io/squish/web-evaljs-function.html#web-evaljs-function
      https://doc.qt.io/squish/how-to-use-the-web-api.html#how-to-use-evaljs

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved