How do you find element using Java Script?

Answer Posted / grbhniti@yahoo.co.in

Hi,
By using javascriptexecutor we can perform tasks as below
I am entering text in textbox by passing ID.

JavascriptExecutor js= (JavascriptExecutor)driver;
js.executeScript("document.getElementById('vfb-9').value='Ramchandra Patil'");

Is This Answer Correct ?    11 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can we create object repository in selenium?

510


What are the limitations of using selenium as a test tool?

483


Tell me how do perform drag and drop using selenium webdriver?

486


What are the advantages of pom (page object model)?

3025


When do we use findelement() and findelements()?

490






What are the main advantages of selenium grid?

507


what is the difference between absolute path and relative path?

563


Is it possible to automate the captcha using selenium?

493


What is the selenium webdriver?

529


How to assert text of webpage using selenium 2.0?

481


Explain how you can switch between frames?

538


How to check if a button is enabled on the page?

523


What is the difference between setspeed() and sleep() methods?

567


How can we handle pop-ups in rc?

524


How to find whether an element is displayed on the web page?

498