!!

Welcome to Selenium Webdriver Forum

As a web user you can read and search through forum content. Once you have registered and signed you can post topics, post replies, set up watch lists, modify forum settings, and use private messaging.

Author Topic: Selenium: Can i set any of the attribute value of a WebElement in Selenium?  (Read 3581 times)

Yami

  • Web User
Hi,
 I have a WebElement, i want to reset its an attribute's value to some
 other value(for e.g. 'attr' is the attribute,and i want to change its
 original value=1 to new value=10). Is it possible? I am using
 Selenium2.0(WebDriver). Please help.
 Thanks

Luke Inman-Semerau

  • Web User
You might be able to with the JavascriptExecutor
 
(assuming java)
 
WebElement element; // however you found it.
 ((JavascriptExecutor)driver).executeScript("arguments[0].attr =
 arguments[1];", element, 10);
 

- Show quoted text -

Yaminee Rajoria

  • Web User
HI,
   Thanks for your reply:-)
 I got the same reply through
 http://stackoverflow.com/questions/8473024/selenium-can-i-set-any-of-...
 well.
 Your answer will surely work for me. But still i am more keen if we would
 had the complete DOM capability through WebElement itself.
 Rgds
 Yaminee
 
On Thu, Dec 22, 2011 at 3:40 AM, Luke Inman-Semerau
 <luke.seme...@gmail.com>wrote:
 

- Show quoted text -

Selenium Webdriver


 

Related Topics

  Subject / Started by Replies Last post
16 Replies
4713 Views
Last post February 23, 2012, 08:58:34 PM
by Dawei
2 Replies
1217 Views
Last post February 23, 2012, 08:59:11 PM
by Mark Collin
1 Replies
1064 Views
Last post May 02, 2012, 09:21:37 PM
by Gulshan Saini
1 Replies
3189 Views
Last post May 03, 2012, 11:12:12 PM
by sita maram
1 Replies
1324 Views
Last post May 09, 2012, 10:12:49 PM
by Selenium Webdriver Admin
3 Replies
197 Views
Last post January 05, 2014, 08:22:58 PM
by rajenrishi
0 Replies
11 Views
Last post April 14, 2014, 03:45:47 AM
by RFlick