Take the 2-minute tour ×
Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It's 100% free, no registration required.

There is a similar question concerning Watir-WebDriver.

What is the best way to do Ctrl+click on a DOM element?

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

A Google search of "webdriver ctrl click" turned up this result:

Ctrl+click requires three actions: a send_keys action to press the CTRL key, then a click action, and then another send_keys action to release the CTRL key.

share|improve this answer
    
Thanks. What I'm confused about is that send_keys is done with respect to an element (i.e. element.send_keys). What element should I choose here? –  Randomblue Jan 23 '12 at 17:17
    
The wording of the original question suggests you already have an element in mind. Are you asking how to identify that element to Webdriver? –  user246 Jan 24 '12 at 2:11
    
Well the element to do the click on is determined. But there is no specific element listening to the "Ctrl" event. –  Randomblue Jan 24 '12 at 9:11
    
The answer may depend upon which event propagation model you use, but I believe you can direct the CTRL key press/release to the body element. –  user246 Jan 24 '12 at 15:13
add comment

The element is nothing but the variable to find the properties of the object so we are using WebElement to find it

WebElement obj = findElement(By.Xpath("")).click(); 
obj.sendkeys("xxxxx");

If you guys want to click submit button you can use code obi.submit(). This code navigates to the next page. It acts as the button click().

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.