Search
 
 

Display results as :
 


Rechercher Advanced Search

Latest topics
» Run automated selenium test scripts from JIRA ondemand
Fri Dec 08, 2017 12:40 pm by azharuddin

» New! Appium Desktop
Sat Nov 25, 2017 3:51 pm by azharuddin

» Selenium WebDriver Integration
Tue Nov 21, 2017 1:06 pm by azharuddin

» how to connect DB in selenium webriver
Fri Oct 06, 2017 4:09 pm by anbarasi

» How find any text in browser screen and click on it?
Thu Oct 05, 2017 2:02 pm by sandeepkommineni

» Selenium Webdriver
Tue Oct 03, 2017 1:35 pm by PiyushBiswas

» GRID setup tutorial.
Wed Sep 27, 2017 4:29 pm by johnyapp

» Drag & Drop Between Windows Using Selenium Driver
Wed Sep 27, 2017 2:10 pm by 26rondel

» Check if window is closed / verify input
Sat Sep 23, 2017 10:21 pm by brainstir

Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

Get CSS value

View previous topic View next topic Go down

Get CSS value

Post by Borisman on Thu Jan 16, 2014 5:24 pm

Hi all, i'm very new in Selenium, i would like to ask how to get CSS value with Selenium IDE ?

Thanks before.

Borisman

Posts : 5
Join date : 2014-01-16
Age : 24
Location : Indonesia

Back to top Go down

Re: Get CSS value

Post by ccox on Fri Jan 17, 2014 3:45 am

storeValue| css locator | variable

the css locator will be the location at which the variable you are looking to get is.

Then try
echo | ${variable}

That will write what the stored value is in the log

ccox
Master
Master

Posts : 205
Join date : 2012-01-06
Age : 32
Location : Denver, CO

Back to top Go down

Re: Get CSS value

Post by Borisman on Fri Jan 17, 2014 8:32 am

Could you give me an example from this code ?

HTML :
Code:
echo <<<HTML
<div id="div1">text</div>
HTML;

CSS :
#div1
{ font-size: 12em; }


Thanks before.

Borisman

Posts : 5
Join date : 2014-01-16
Age : 24
Location : Indonesia

Back to top Go down

Re: Get CSS value

Post by ccox on Fri Jan 17, 2014 10:25 pm

Why are you using the css locator? You have an id.  In my opinion, id's are much better to use.

storeValue| id=div1| variable
echo | ${variable}

ccox
Master
Master

Posts : 205
Join date : 2012-01-06
Age : 32
Location : Denver, CO

Back to top Go down

Re: Get CSS value

Post by Borisman on Sat Jan 18, 2014 12:03 am

No, what i mean is how to get the font-size value of that css code ?

Borisman

Posts : 5
Join date : 2014-01-16
Age : 24
Location : Indonesia

Back to top Go down

Re: Get CSS value

Post by ccox on Sat Jan 18, 2014 12:54 am

Try this:

storeEval |window.getComputedStyle(window.document.getElementById('div1'), null).getPropertyValue("font-size"); | variable

echo | ${variable}

This worked for me to get the font-size and all other css variables

ccox
Master
Master

Posts : 205
Join date : 2012-01-06
Age : 32
Location : Denver, CO

Back to top Go down

Re: Get CSS value

Post by ccox on Sat Jan 18, 2014 5:10 am

FYI, Selenium IDE doesn't have a built-in function for getting CSS attributes.  However, Selenium IDE is great at executing javascript using the storeEval and getEval commands.  You just have to implement the results of the execution to fit your needs.

ccox
Master
Master

Posts : 205
Join date : 2012-01-06
Age : 32
Location : Denver, CO

Back to top Go down

Re: Get CSS value

Post by Borisman on Sat Jan 18, 2014 11:15 am

It's work! Thanks a lot.

Btw, i have a project which needs to store all HTML element property value, so i need to access not only HTML but CSS and javascript of the web.

Could you give me an advice which selenium i prefer to use to fit that needs ?

Borisman

Posts : 5
Join date : 2014-01-16
Age : 24
Location : Indonesia

Back to top Go down

Re: Get CSS value

Post by acts79 on Wed Feb 26, 2014 4:31 pm

Finally found this one, thanks for posting. Really Helps

acts79

Posts : 3
Join date : 2014-02-18

http://ny.pe

Back to top Go down

Re: Get CSS value

Post by Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum