Skip to content

Latest commit

ย 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Problem:

๐”๐ฌ๐ข๐ง๐  ๐ฌ๐ž๐ฅ๐ž๐ง๐ข๐ฎ๐ฆ ๐š๐ฎ๐ญ๐จ๐ฆ๐š๐ญ๐ข๐จ๐ง - ๐ซ๐ž๐š๐ ๐ญ๐ก๐ž * ๐ซ๐š๐ญ๐ข๐ง๐  ๐จ๐Ÿ ๐ญ๐ก๐ž ๐›๐จ๐จ๐ค, ๐ž๐ง๐ญ๐ž๐ซ ๐ข๐ญ ๐ข๐ง ๐ญ๐ก๐ž ๐ญ๐ž๐ฑ๐ญ ๐›๐จ๐ฑ ๐š๐ง๐ ๐œ๐ฅ๐ข๐œ๐ค "๐œ๐ก๐ž๐œ๐ค ๐ซ๐š๐ญ๐ข๐ง๐ " ๐›๐ฎ๐ญ๐ญ๐จ๐ง. ๐ฒ๐จ๐ฎ ๐ฌ๐ก๐จ๐ฎ๐ฅ๐ ๐ฌ๐ž๐ž "๐ฐ๐ž๐ฅ๐ฅ ๐๐จ๐ง๐ž!" ๐ฆ๐ž๐ฌ๐ฌ๐š๐ ๐ž.

๐‹๐ข๐ง๐ค: https://lnkd.in/dr5adTZK ๐‡๐ข๐ง๐ญ: Use CSS Pseudo-elements Concept

๐…๐จ๐ซ ๐ฆ๐จ๐ซ๐ž ๐ˆ๐ง๐Ÿ๐จ ๐จ๐ง ๐‚๐’๐’ ๐๐ฌ๐ž๐ฎ๐๐จ-๐ž๐ฅ๐ž๐ฆ๐ž๐ง๐ญ๐ฌ: https://lnkd.in/d9Uhd8QV

Your challenge is given above - just open the link & write down your automation script. You can code in any language you like - Java, Python,C# etc.

๐’๐ก๐š๐ซ๐ž ๐ฒ๐จ๐ฎ๐ซ ๐œ๐จ๐๐ž๐ฌ ๐ข๐ง ๐š ๐œ๐จ๐ฆ๐ฆ๐ž๐ง๐ญ! - ๐‹๐ž๐ญ'๐ฌ ๐‹๐ž๐š๐ซ๐ง & ๐†๐ซ๐จ๐ฐ ๐“๐จ๐ ๐ž๐ญ๐ก๐ž๐ซ!๐Ÿ˜Š

Let's jump in and make Day 3 a success!

Solution: Checkout the Master branch with Solution class.

Following is walkthrough to the code:

  1. What is CSS: to add some style to some element

  2. Pseudo Element: Now what if we want to apply some style let us color property to some portion of an element then comes Pseudo element.

  3. How to add pseudo element style by simply adding double colon to the style (::)

then we can use Before, After, firstline, firstletter, marker etc to provide additional style to portion of above elements eg: to firstline, to firstletter etc.

Solution walkthrough:

Please take a look on above git repo

Now let us talk about original question how to get the text of rating which is using the concept of Pseudo element and has dom:

::after

  1. click on after

  2. In lower section styles will appear which will show additional information like as follows:

content: "***";

display: inline-block;

  1. So now we need to get content and same is not possible through getText() because this is not directly available as part of element

  2. We will have to use JavaScriptExecutor first thing to deal with these elements.

  3. First of all need to find css which .className so it will be .star-rating in this case

  4. Once we got the css, now we need to write following line:

js.executeScript("return window.getComputedStyle(document.querySelector('.star-rating'),'::after').getPropertyValue('content')")

.toString();

  1. document.QuerySelector will let us point to the element.

  2. Once we get the element using css selector next step is to reach to pseudo element related content, so we will use getComputedStyle method.

  3. this is how we will be able to find the

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages