python / selenium job
For this job we're looking for a Python developer with knowledge of Selenium ([login to view URL]).
Your job is to make an automated testing script for this service service: Surfly.com. This script will verify that a site (provided on a command line) works the same through Surfly as it does directly. To do that, it will load the site directly, get its content ([login to view URL]) and then load the site through Surfly, get its content and then compare the output. Some differences are expected (see below), but anything else means that the site does not work through Surfly.
For example, if I go to [login to view URL] in Chrome 34 I see "628 Pass, 4 Fail". However, if I go to [login to view URL] and start a session on [login to view URL] I see a different result: "618 Pass, 14 Fail".
On the other hand, if I go to [login to view URL] I see "4 Pass" both directly and through Surfly.
You script, once written would work like this:
```
$ browser=chrome ./[login to view URL] [login to view URL]
FAILED!
<difference between original output and surfly output follows>
...
- 628 Pass, 4 Fail
+ 618 Pass, 14 Fail
```
$ browser=chrome ./[login to view URL] [login to view URL]
PASSED!
```
Note, that [login to view URL] is used as an example, but the script should work on any website.
The actual output in case of error will be different of course, but it would show:
- whether the pages are the same or not
- if they are not the same, what's different
The difference should be shown by pretty printing HTML into temp files and then using colordiff program to compare them.
The page comparison should ignore the following:
- contents of <script> tags
- contents of <style> tags
- contents of javascript-containing attributes, like "onload" (everything starting with "on")
- certain scripts tags
- certain attributes attributes on certain following elements (a list will be provided to you)
Requirements:
- works on Python 2.7
- works on Ubuntu 12.04
- works with chrome and firefox (configured via env var browser)
- stable enough: the script has builtin resistance to selenium and network failures and consistently outputs PASSED for sites that work and FAILED for those that don't.
- works on arbitrary sites (as long as they are accessible through surfly)
Include answers to the following questions in your application:
1. What is the value of `map(lambda x: x**2, [1, 2, 3])` ?
2. What does this following code does in Python/Selenium?
```
el = browser.find_element_by_xpath("//input[@name='%s']" % name)
```
3. What is the difference in output when going to [login to view URL] directly and through Surfly?
Milestone 0.
In the test task you'd need to write a Python/Selenium script that uses Surfly API ([login to view URL]) to load a page through Surfly and print the pretty-formatted contents of it to console.
Milestone 1. A simple script.
A simple script loads the page it receives on the command-line as described above. It also must be able to receive the list of urls from a file.
It also must include the ability to limit comparison to certain subtree, by id of an element. For example:
```
$ [login to view URL] --limit '#summary' [login to view URL]
PASSED
```
The --limit option means that instead of comparing [login to view URL], the comparison is done on element with id=summary and all trees below ([login to view URL]("#summary").innerHTML should probably work there).
I have vast experience in working with selenium webdriver in python and java. I have made bots using selenium to extract data from facebook, craigslist, gumtree etc.
I have developed advanced skills in this domain.
Answers to your question
1) [1,4,9]
2) lets say
name="username"
so it will return first input element whose name attribute value is username.
3) when accessed directly
137 Pass
55 Fail
Using surfly
47 Pass
145 Fail
I have more than 4 years of experience.
If you would have used find_elements_by_xpath (note elements), then it would have returned all input element whose value is equal to name variable value
Have already done this kind of job. I can create the code for you within 5 to 7 days. I am having more than 17 yrs of experience in software. Please let me know.