S
S
Sergey Kudrya2015-05-19 10:40:17
Angular
Sergey Kudrya, 2015-05-19 10:40:17

Protractor angular js (testing). How to click on an element that only appears on hover?

Good day.
Please tell me how you can click on an element (button), which appears only when you hover over it with the mouse cursor.
My Protractor code:
First I set variables with selectors:
var ButtonEditBanner = element(by.xpath(".//*[@id='slider']/ul/li[1]/a"));
var SaveBanner = element(by.xpath(".//*[@id='saveCovver']"));
var UploudImage = element(by.id('imageLoader'));
var WindowBanner = element(by.xpath(".//*[@id='bannerwrapper']/img"));
Then the execution itself:
it ('opens page', function() {
WindowBanner.click();
ButtonEditBanner.click();
var fileToUpload = '/Users/sergey/Desktop/wallpapers/12511H.jpg', absolutePath = path.resolve(__dirname, fileToUpload);
browser.wait(10000);
UploudImage.sendKeys(absolutePath);
SaveBanner.click();
browser.driver.sleep(3000);
});
but the execution does not even start because the bud is hidden until you hover over it with the mouse.
Help, I'm sure there are many experienced fighters.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Gavrilov, 2015-05-19
@FireVolkhov

Perhaps it will help you

ptor.actions().
    mouseMove(ptor.findElement(protractor.B.id('foo'))).
    perform();

Causes a hover on an element
Original https://github.com/angular/protractor/issues/159

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question