Chromedriver finding an xpath just fine with a head, but not when headless [duplicate]Gmail login using selenium webdriver in javaLog into gmail using Selenium in PythonJUnit (Selenium WebDriver) to open www.google.co.uk in Chrome Browserwhy 2nd click action is not run when browser is Google ChromeHow to open chrome developer console using Selenium in Python?Executable needs to be in PATH - Running Selenium on GNURoot on AndroidBrowserMob Proxy Python - How to get response body?Chrome closing after some time and produce error selenium.common.exceptions.WebDriverException: Message: Can not connect to the Service in pythonSET ERROR IGNORE Python selenium--headless is not an option in chrome webdriver for selenium python

Was the Boeing 2707 design flawed?

Architectural feasibility of a tiered circular stone keep

Changing JPEG to RAW to use on Lightroom?

Can $! cause race conditions when used in scripts running in parallel?

HJM in infinite dimensions

Very slow boot time and poor perfomance

Can RMSE and MAE have the same value?

Evaluated vs. unevaluated Association

Command "root" and "subcommands"

Server Integrity Check CheckCommands question

Duplicate instruments in unison in an orchestra

Why is the UK so keen to remove the "backstop" when their leadership seems to think that no border will be needed in Northern Ireland?

Discussing work with supervisor in an invited dinner with his family

Higman's lemma and a manuscript of Erdős and Rado

How can I download a file through 2 SSH connections?

Cooking Scrambled Eggs

Why do proofs of Bernoulli's equation assume that forces on opposite ends point in different directions?

When, exactly, does the Rogue Scout get to use their Skirmisher ability?

Ordering a list of integers

Handling Disruptive Student on the Autism Spectrum

"There were either twelve sexes or none."

Removal of て in Japanese novels

What is a natural problem in theory of computation?

Where can/should I, as a high schooler, publish a paper regarding the derivation of a formula?



Chromedriver finding an xpath just fine with a head, but not when headless [duplicate]


Gmail login using selenium webdriver in javaLog into gmail using Selenium in PythonJUnit (Selenium WebDriver) to open www.google.co.uk in Chrome Browserwhy 2nd click action is not run when browser is Google ChromeHow to open chrome developer console using Selenium in Python?Executable needs to be in PATH - Running Selenium on GNURoot on AndroidBrowserMob Proxy Python - How to get response body?Chrome closing after some time and produce error selenium.common.exceptions.WebDriverException: Message: Can not connect to the Service in pythonSET ERROR IGNORE Python selenium--headless is not an option in chrome webdriver for selenium python






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1
















This question already has an answer here:



  • Gmail login using selenium webdriver in java

    1 answer



  • Log into gmail using Selenium in Python

    1 answer



I built a program which has different functions that interact with some of the google services, but first of all it has to login to the specified google account. When the chrome has a head, it works fine, but when I attempted to make it headless, it couldn't find the xpath of the first element, which was the email field. The code I've got is below.



from selenium import webdriver
from selenium.webdriver.chrome.options import Options

options = Options()
options.add_argument("--headless")
driver = webdriver.Chrome(executable_path=r"C:\path\to\chromedriver.exe", options=options)


And then it tries to log in with the specified credentials.



driver.get('https://accounts.google.com/signin/v2')
driver.find_element_by_xpath('//*[contains(@name,"identifier")]').send_keys('mail')
driver.find_element_by_xpath('//*[@id="identifierNext"]/content/span').click()
driver.find_element_by_xpath('//*[contains(@name,"password")]').send_keys('password')
driver.find_element_by_xpath('//*[@id="passwordNext"]/content/span').click()


While this works fine without the



 options.add_argument("--headless")


it doesnt work with it and I have no idea why. I would appreciate any help on the matter. Both chrome and chromedriver are updated to the latest version.










share|improve this question














marked as duplicate by DebanjanB selenium
Users with the  selenium badge can single-handedly close selenium questions as duplicates and reopen them as needed.

StackExchange.ready(function()
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();

);
);
);
Mar 27 at 21:32


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

























    1
















    This question already has an answer here:



    • Gmail login using selenium webdriver in java

      1 answer



    • Log into gmail using Selenium in Python

      1 answer



    I built a program which has different functions that interact with some of the google services, but first of all it has to login to the specified google account. When the chrome has a head, it works fine, but when I attempted to make it headless, it couldn't find the xpath of the first element, which was the email field. The code I've got is below.



    from selenium import webdriver
    from selenium.webdriver.chrome.options import Options

    options = Options()
    options.add_argument("--headless")
    driver = webdriver.Chrome(executable_path=r"C:\path\to\chromedriver.exe", options=options)


    And then it tries to log in with the specified credentials.



    driver.get('https://accounts.google.com/signin/v2')
    driver.find_element_by_xpath('//*[contains(@name,"identifier")]').send_keys('mail')
    driver.find_element_by_xpath('//*[@id="identifierNext"]/content/span').click()
    driver.find_element_by_xpath('//*[contains(@name,"password")]').send_keys('password')
    driver.find_element_by_xpath('//*[@id="passwordNext"]/content/span').click()


    While this works fine without the



     options.add_argument("--headless")


    it doesnt work with it and I have no idea why. I would appreciate any help on the matter. Both chrome and chromedriver are updated to the latest version.










    share|improve this question














    marked as duplicate by DebanjanB selenium
    Users with the  selenium badge can single-handedly close selenium questions as duplicates and reopen them as needed.

    StackExchange.ready(function()
    if (StackExchange.options.isMobile) return;

    $('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
    var $hover = $(this).addClass('hover-bound'),
    $msg = $hover.siblings('.dupe-hammer-message');

    $hover.hover(
    function()
    $hover.showInfoMessage('',
    messageElement: $msg.clone().show(),
    transient: false,
    position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
    dismissable: false,
    relativeToBody: true
    );
    ,
    function()
    StackExchange.helpers.removeMessages();

    );
    );
    );
    Mar 27 at 21:32


    This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.





















      1












      1








      1









      This question already has an answer here:



      • Gmail login using selenium webdriver in java

        1 answer



      • Log into gmail using Selenium in Python

        1 answer



      I built a program which has different functions that interact with some of the google services, but first of all it has to login to the specified google account. When the chrome has a head, it works fine, but when I attempted to make it headless, it couldn't find the xpath of the first element, which was the email field. The code I've got is below.



      from selenium import webdriver
      from selenium.webdriver.chrome.options import Options

      options = Options()
      options.add_argument("--headless")
      driver = webdriver.Chrome(executable_path=r"C:\path\to\chromedriver.exe", options=options)


      And then it tries to log in with the specified credentials.



      driver.get('https://accounts.google.com/signin/v2')
      driver.find_element_by_xpath('//*[contains(@name,"identifier")]').send_keys('mail')
      driver.find_element_by_xpath('//*[@id="identifierNext"]/content/span').click()
      driver.find_element_by_xpath('//*[contains(@name,"password")]').send_keys('password')
      driver.find_element_by_xpath('//*[@id="passwordNext"]/content/span').click()


      While this works fine without the



       options.add_argument("--headless")


      it doesnt work with it and I have no idea why. I would appreciate any help on the matter. Both chrome and chromedriver are updated to the latest version.










      share|improve this question















      This question already has an answer here:



      • Gmail login using selenium webdriver in java

        1 answer



      • Log into gmail using Selenium in Python

        1 answer



      I built a program which has different functions that interact with some of the google services, but first of all it has to login to the specified google account. When the chrome has a head, it works fine, but when I attempted to make it headless, it couldn't find the xpath of the first element, which was the email field. The code I've got is below.



      from selenium import webdriver
      from selenium.webdriver.chrome.options import Options

      options = Options()
      options.add_argument("--headless")
      driver = webdriver.Chrome(executable_path=r"C:\path\to\chromedriver.exe", options=options)


      And then it tries to log in with the specified credentials.



      driver.get('https://accounts.google.com/signin/v2')
      driver.find_element_by_xpath('//*[contains(@name,"identifier")]').send_keys('mail')
      driver.find_element_by_xpath('//*[@id="identifierNext"]/content/span').click()
      driver.find_element_by_xpath('//*[contains(@name,"password")]').send_keys('password')
      driver.find_element_by_xpath('//*[@id="passwordNext"]/content/span').click()


      While this works fine without the



       options.add_argument("--headless")


      it doesnt work with it and I have no idea why. I would appreciate any help on the matter. Both chrome and chromedriver are updated to the latest version.





      This question already has an answer here:



      • Gmail login using selenium webdriver in java

        1 answer



      • Log into gmail using Selenium in Python

        1 answer







      python selenium xpath






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 27 at 18:34









      NaayNaay

      286 bronze badges




      286 bronze badges





      marked as duplicate by DebanjanB selenium
      Users with the  selenium badge can single-handedly close selenium questions as duplicates and reopen them as needed.

      StackExchange.ready(function()
      if (StackExchange.options.isMobile) return;

      $('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
      var $hover = $(this).addClass('hover-bound'),
      $msg = $hover.siblings('.dupe-hammer-message');

      $hover.hover(
      function()
      $hover.showInfoMessage('',
      messageElement: $msg.clone().show(),
      transient: false,
      position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
      dismissable: false,
      relativeToBody: true
      );
      ,
      function()
      StackExchange.helpers.removeMessages();

      );
      );
      );
      Mar 27 at 21:32


      This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.











      marked as duplicate by DebanjanB selenium
      Users with the  selenium badge can single-handedly close selenium questions as duplicates and reopen them as needed.

      StackExchange.ready(function()
      if (StackExchange.options.isMobile) return;

      $('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
      var $hover = $(this).addClass('hover-bound'),
      $msg = $hover.siblings('.dupe-hammer-message');

      $hover.hover(
      function()
      $hover.showInfoMessage('',
      messageElement: $msg.clone().show(),
      transient: false,
      position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
      dismissable: false,
      relativeToBody: true
      );
      ,
      function()
      StackExchange.helpers.removeMessages();

      );
      );
      );
      Mar 27 at 21:32


      This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.









      marked as duplicate by DebanjanB selenium
      Users with the  selenium badge can single-handedly close selenium questions as duplicates and reopen them as needed.

      StackExchange.ready(function()
      if (StackExchange.options.isMobile) return;

      $('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
      var $hover = $(this).addClass('hover-bound'),
      $msg = $hover.siblings('.dupe-hammer-message');

      $hover.hover(
      function()
      $hover.showInfoMessage('',
      messageElement: $msg.clone().show(),
      transient: false,
      position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
      dismissable: false,
      relativeToBody: true
      );
      ,
      function()
      StackExchange.helpers.removeMessages();

      );
      );
      );
      Mar 27 at 21:32


      This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
























          0






          active

          oldest

          votes














          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes




          Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.







          Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.





          Popular posts from this blog

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

          Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript