title: selenium twitter login without new device notification
body: <p>Is there a way to log in to twitter with selenium/python without getting the notification &quot;login from a new device&quot; on Twitter?</p>
  <p>Current code is</p>
  <pre><code>import urllib.request
  import selenium
  from bs4 import BeautifulSoup
  import requests 
  import re
  import json
  
  options = webdriver.ChromeOptions() 
  options.add_argument(&quot;start-maximized&quot;)
  options.add_experimental_option(&quot;excludeSwitches&quot;, [&quot;enable-automation&quot;])
  options.add_experimental_option('useAutomationExtension', False)
  driver = webdriver.Chrome(options=options, executable_path='./chromedriver')
  driver.execute_script(&quot;Object.defineProperty(navigator, 'webdriver', {get: () =&gt; undefined})&quot;)
  driver.execute_cdp_cmd('Network.setUserAgentOverride', {&quot;userAgent&quot;: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.53 Safari/537.36'})
  print(driver.execute_script(&quot;return navigator.userAgent;&quot;))
  
  def twitter_login(driver, username, password):
      driver.get('https://twitter.com/login')
      driver.find_element_by_xpath(&quot;//input[contains(@name,'username')]&quot;).send_keys(username)
      driver.find_element_by_xpath(&quot;//input[contains(@name,'password')]&quot;).send_keys(password)
      driver.find_elements_by_xpath(&quot;//*[contains(text(), 'Log in')]&quot;)[1].click()
  
  
  twitter_login(driver, username, password)
  </code></pre>