![]() WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.ID, 'ls-highlight-domref')))Īs it can be seen I get all the network calls that the browser makes in the first line of the extract_url function and then parse each request to find the correct one. # options.add_argument('headless') # DOES NOT WORK IN HEADLESS MODE SO COMMENTED OUTĭriver = webdriver.Chrome(options=options) The code that I wrote is as follows: import requestsįrom urllib3.exceptions import InsecureRequestWarningįrom import WebDriverWaitįrom import expected_conditions as ECįrom import ByĪdvice_requests = driver.execute_script("var performance = window.performance || window.mozPerformance || window.msPerformance || window.webkitPerformance ||. I was able to do this using selenium, but my code fails to work when the browser is used in headless mode and I need it to work in headless mode. I want to be able to call the url with a variable for the query param TRACKNO and to be able to save the pdf file using python. This is because The URL: does not directly return the pdf but in turn makes several other calls and one of them is the url that returns the pdf file. Note: This is very different problem compared to other SO answers ( Selenium Webdriver: How to Download a PDF File with Python?) available for similar questions.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |