Answer the question
In order to leave comments, you need to log in
How to "combine" the work of selenium webdriver and pyTest in order to write an autotest for some actions on the site?
Using selenium webdriver and the pytest test framework, I want to "simulate" certain user actions on the site in python.
tell me where to look in order to understand how to implement this through the friendly work of these tools?
I can not find at least some understandable manuals or articles.
Answer the question
In order to leave comments, you need to log in
Didn't work with selenium but worked a lot with casper .
The principles must be the same.
How do I do it in Casper?
Let's take a basic example.
var casper = require('casper').create();
var links;
function getLinks() {
// Scrape the links from top-right nav of the website
var links = document.querySelectorAll('ul.navigation li a');
return Array.prototype.map.call(links, function (e) {
return e.getAttribute('href')
});
}
// Opens casperjs homepage
casper.start('http://casperjs.org/');
casper.then(function () {
links = this.evaluate(getLinks);
});
casper.run(function () {
for(var i in links) {
console.log(links[i]);
}
casper.done();
});
var casper = require('casper').create();
var links;
function getLinks() {
// Scrape the links from top-right nav of the website
var links = document.querySelectorAll('ul.navigation li a');
return Array.prototype.map.call(links, function (e) {
return e.getAttribute('href')
});
}
// Opens casperjs homepage
casper.start('http://casperjs.org/');
casper.then(function () {
links = this.evaluate(getLinks);
});
casper.run(function () {
for(var i in links) {
console.log(links[i]);
}
});
casper.thenOpen('http://phantomjs.org', function() {
this.echo(this.getTitle());
});
casper.then(function () {
links = this.evaluate(getLinks);
});
casper.run(function () {
for(var i in links) {
console.log(links[i]);
}
});
Use the documentation of the framework and webdriver.
Perform initialization, driver setup in the fixture and pass it on to the test in the same form.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question