Question

I have today tried to send the data via a form but the data must go in a post uri, Is there a way of appending the params to the form uri in a view which I could then submit a click to.

I have tried the code below. However,

driver.findElement(protractor.By.name('formelement')).setAttribute('action', attr);

returns Object has no method setAttribute

driver.findElement(protractor.By.name('externalFormData')).getText().then(function(result){
    var attr = driver.findElement(proractor.By.name('formelement').getAttribute('action');
    attr += result;
    driver.findElement(protractor.By.name('formelement')).setAttribute('action', attr);
    driver.findElement(protractor.By.name('submitRequest')).click();
});
Was it helpful?

Solution

Julie Ralph, the lead developer on protractor says its not (natively) possible here:

https://github.com/angular/protractor/issues/82

juliemr commented on Sep 12, 2013 A user wouldn't set an attribute, so it's not a feature of webdriver. Can you find a way of running your test manually just using your page? It seems that you might have to use angular and $http.post() instead of just relying on the 's action attribute.

Personally, this stinks a little. I have tests timing out because sendKeys is so slow on long text files. I'll keep you updated if I find a good work-around. Maybe there needs to be a 'pasteTextBlock' instead of 'sendKeys' ... by Julie's rationale a user might copy and paste rather than key in...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top