using below code, sends key in browser url not in google search text box. want enter text in google search text field using keyboard event in caps.
driver.get(https://www.google.co.in/); actions builder = new actions(driver); action entertext = builder.click(driver.findelement(by. cssselector("input[type=text]"))). keydown(keys.shift). sendkeys("my gmail"). keyup(keys.shift). build(); entertext.perform();
you can use
driver.findelement("yourelementlocator").sendkeys(keys.shift,"yourtexttobetyped")
example,
driver.findelement(by.cssselector("input[type=text]")).sendkeys(keys.shift,"stackoverflow")
will send 'stackoverflow'. or else can send capital letters directly in send keys
driver.findelement(by.cssselector("input[type=text]")).sendkeys("stackoverflow")
:)
Comments
Post a Comment