0

I wanna access input field, for entering username in selenium with headless browser

And this is the code

document.write("<input name='username' type='text' id='username'/>");

How to access and enter the value when the HTML code is written inside JavaScript?

demouser123
  • 4,108
  • 9
  • 50
  • 82
Akshay R
  • 1
  • 1
  • Why dont oyu enable javascript on the browser and edit the value when the elements are added to the DOM ? –  Nov 20 '19 at 11:27
  • I want it to work in headless mode(no popup) so I am using HtmlUnitDriver – Akshay R Nov 21 '19 at 14:01

1 Answers1

0

When you write to the document, you add to the DOM, so you should be able to get the element by ID from the DOM.

hairysocks
  • 111
  • 7
  • In selenium using chrome I can but while using headless browser like HtmlUnitDriver I couldn't access JavaScript – Akshay R Nov 21 '19 at 13:55