1. Get Browser Name, Version and Environment Details
Java Script Expressions which you can use by Selenium.getEval to get the values.
2. Get Current URL
selenium.getLocation()
3. Scroll Bar Position
If you are using Selenium 1.0, use this.browserbot
If you are using Selenium 2.0, use selenium.browserbot
4. JavaScript Expression execution in Selenium 2.0
Java Script Expressions which you can use by Selenium.getEval to get the values.
- navigator.appCodeName //For Browser Name
- navigator.appVersion //For Browser Version
- navigator.userAgent //For both details
- navigator.appName //For Browser Name
- navigator.cookieEnabled //Cookie enabled or not
- navigator.platform //OS
2. Get Current URL
selenium.getLocation()
3. Scroll Bar Position
- Actual Width/Height of element:(Excluding ScrollBar)
- selenium.browserbot.getCurrentWindow().document.getElementByid('css#id').clientWidth
- selenium.browserbot.getCurrentWindow().document.getElementByid('css#id').clientHeight
- Max Scroll Position:
- scrollWidth - clientWidth //Max Horizontal Scroll Position
- scrollHeight - clientHeight //Max Vertical Scroll Position
- Current Scroll Position:
- scrollLeft
- scrollTop
If you are using Selenium 1.0, use this.browserbot
If you are using Selenium 2.0, use selenium.browserbot
4. JavaScript Expression execution in Selenium 2.0
- JavascriptExecutor js = (JavascriptExecutor)driver;
- "return ele[0].getAttribute(\"title\");";
Comments
Post a Comment