Create an automated script that login in into netflix
<p>I'd like to make an automated script in python using selenium that log in here: <a href="https://www.netflix.com/Login" rel="nofollow">https://www.netflix.com/Login</a>.
I've tried with this code:</p>

<pre><code>from selenium import webdriver

driver = webdriver.Firefox()
driver.get("https://www.netflix.com/Login")
while True:
    element = driver.find_element_by_css_selector("ui-text-input[name = 'email']")
    driver.execute_script("arguments[0].setAttribute('value','test1')", element)
    element2 = driver.find_element_by_css_selector("ui-text-input[name = 'password']")
    driver.execute_script("arguments[0].setAttribute('value','test1')", element2)
    driver.refresh()
</code></pre>

<p>But it raises an error occurred in this line of code:</p>

<pre><code>Traceback (most recent call last):
  File "netflixlogin.py", line 6, in &lt;module&gt;
    element = driver.find_element_by_css_selector("ui-text-input[name = 'email']")
  File "/home/user/.local/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", line 437, in find_element_by_css_selector
    return self.find_element(by=By.CSS_SELECTOR, value=css_selector)
  File "/home/user/.local/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", line 752, in find_element
    'value': value})['value']
  File "/home/user/.local/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", line 236, in execute
    self.error_handler.check_response(response)
  File "/home/user/.local/lib/python3.5/site-packages/selenium/webdriver/remote/errorhandler.py", line 192, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: {"method":"css selector","selector":"ui-text-input[name = 'email']"}
Stacktrace:
    at FirefoxDriver.prototype.findElementInternal_ (file:///tmp/tmpk_odq6d0/extensions/fxdriver@googlecode.com/components/driver-component.js:10770)
    at FirefoxDriver.prototype.findElement (file:///tmp/tmpk_odq6d0/extensions/fxdriver@googlecode.com/components/driver-component.js:10779)
    at DelayedCommand.prototype.executeInternal_/h (file:///tmp/tmpk_odq6d0/extensions/fxdriver@googlecode.com/components/command-processor.js:12661)
    at DelayedCommand.prototype.executeInternal_ (file:///tmp/tmpk_odq6d0/extensions/fxdriver@googlecode.com/components/command-processor.js:12666)
    at DelayedCommand.prototype.execute/&lt; (file:///tmp/tmpk_odq6d0/extensions/fxdriver@googlecode.com/components/command-processor.js:12608)
</code></pre>

<p>So there's a problem in this line of code:</p>

<pre><code>element = driver.find_element_by_css_selector("ui-text-input[name = 'email']")
</code></pre>

<p>Maybe a wrong syntax? I start using selenium recently so I am still not very good</p>

<p>UPDATED SCRIPT with not errors but it doesn't still work:</p>

<pre><code>from selenium import webdriver

driver = webdriver.Firefox()
driver.get("https://www.netflix.com/Login")
while True:
    element = driver.find_element_by_css_selector("form.login-form input[name=email]")
    driver.execute_script("arguments[0].setAttribute('value','test1')", element)
    element2 = driver.find_element_by_css_selector("form.login-form input[name=password]")
    driver.execute_script("arguments[0].setAttribute('value','test1')", element2)
    driver.refresh()
</code></pre>

<p>SOLVED. WORKING SCRIPT:</p>

<pre><code>from selenium import webdriver
from selenium.webdriver.common.keys import Keys

driver = webdriver.Firefox()
driver.get("https://www.netflix.com/it/")
login = driver.find_element_by_css_selector(".authLinks.signupBasicHeader")
login.click()
element = driver.find_element_by_name("email")
element.send_keys("test1@gmail.com")
submit = driver.find_element_by_css_selector(".btn.login-button.btn-submit.btn-small")
submit.click()
element2 = driver.find_element_by_name("password")
element2.send_keys("test1")
submit2 = driver.find_element_by_css_selector(".btn.login-button.btn-submit.btn-small")
submit2.click()
</code></pre>

<p>I think below is syntax for CSS selector in selenium</p>

<pre><code>driver.findElement(By.cssSelector("ui-text-input[name = 'email']"))
</code></pre>

python python-3.x selenium