(Jan-13-2018, 04:58 PM)mgtheboss Wrote: @metulburr Are you using headless configuration?The first one with PhantomJS is headless.
It rather new that both Chrome and FireFox both comes with a headless mode for there driver.
I have used mostly PhantomJS for headless mode.
In future it may bee that PhantomJS is not needed anymore.
With newest version of selenium,gives this message when use PhantomJS.
Quote:Selenium support for PhantomJS has been deprecated, please use headless versions of Chrome or Firefox instead
Here setup that work for me,10-13 seconds run time.
FireFox:
from selenium import webdriver from selenium.webdriver.firefox.options import Options #-- Setup options = Options() options.add_argument("--headless") browser = webdriver.Firefox(firefox_options=options, executable_path=r"path to geckodriver") #-- Parse browser.get('https://www.myntra.com/watches/fossil/fossil-women-rose-gold-toned-dial-watch-es3352i/759168/buy') t = browser.find_element_by_xpath('//*[contains(concat( " ", @class, " " ), concat( " ", "pdp-price", " " ))]') print(t.text) browser.quit()Chrome:
from selenium import webdriver from selenium.webdriver.chrome.options import Options #-- Setup chrome_options = Options() chrome_options.add_argument("--headless") chrome_options.add_argument('--log-level=3') browser = webdriver.Chrome(chrome_options=chrome_options, executable_path=r'path to chromedriver') #-- Parse browser.get('https://www.myntra.com/watches/fossil/fossil-women-rose-gold-toned-dial-watch-es3352i/759168/buy') t = browser.find_element_by_xpath('//*[contains(concat( " ", @class, " " ), concat( " ", "pdp-price", " " ))]') print(t.text) browser.quit()