0

I am scraping a site through selenium and after applying suggested headers and chrome options, it is showing me this in the output in between the desired output [0306/125211.693:INFO:CONSOLE(0)] "A cookie associated with a cross-site resource at http://yahoo.com/ was set without the `SameSite` attribute....

My code:

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

user_agent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/537.36 (KHTML, like Gecko) ' \
             'Chrome/80.0.3987.132 Safari/537.36'

driver_exe = 'chromedriver'
options = Options()
options.add_argument("--headless")
options.add_argument(f'user-agent={user_agent}')
options.add_argument("--disable-web-security")
options.add_argument("--allow-running-insecure-content")
options.add_argument("--allow-cross-origin-auth-prompt")
options.add_argument("--disable-cookie-encryption")

driver = webdriver.Chrome(executable_path=r"C:\Users\intel\Downloads\Setups\chromedriver.exe", options=options)
driver.get("https://www.amazon.com/s?k=asus&rh=n%3A300189&nav_sdd=aps&pd_rd_r=58b28d7d-1955-433b-b33b-b1b5dcf1f522&pd_rd_w=MJzan&pd_rd_wg=QG3cj&pf_rd_p=6d81377b-6d6c-4363-ae02-8fa202ed7b50&pf_rd_r=X0BDDAPN7TTW0ZT1REX6&qid=1583290662&ref=sxwds-sbc_c2")

class_Name = "a-size-medium a-color-base a-text-normal"
x = driver.find_elements_by_class_name(class_Name.replace(' ','.'))

for i in list(x):
    print(i.text,"\n")

The output with the CORS policy in between:

Asus AC1900 Dual Band Gigabit WiFi Router with MU-Mimo, Aimesh for Mesh WIFI System, Aiprotection Network Security Powered by Trend Micro, Adaptive Qos and Parental Control (RT-AC68U)

ASUS AC2900 WiFi Dual-band Gigabit Wireless Router with 1.8GHz Dual-core Processor and AiProtection Network Security Powered by
Trend Micro, AiMesh Whole Home WiFi System Compatible (RT-AC86U)

ASUS AC3200 Tri-Band Gigabit WiFi Router, AiProtection Lifetime Security by Trend Micro, Adaptive QoS, Parental Control (RT-AC3200)

ASUS RT-AX3000 Dual Band WiFi Router, WiFi 6, 802.11ax, Lifetime Internet Security, Support AiMesh Whole-Home WiFi, 4 x 1Gb LAN
Ports, USB 3.0, MU-MIMO, OFDMA, VPN

ASUS Dual-Band Gigabit WiFi Gaming Router (AC3100) with MU-MIMO, supporting AiProtection network security by Trend Micro, AiMesh for Mesh WiFi system, and WTFast game Accelerator (RT-AC88U)

ASUS RT-AC66U B1 AC1750 Dual-Band WiFi Router, AiProtection Lifetime Security by Trend Micro, AiMesh Compatible for Mesh WiFi System

Asus Blue Cave AC2600 Dual-Band Wireless Router for Smart Homes, Featuring Intel Wifi Technology and Aiprotection Network Security Powered by Trend Micro,White

ASUS Rapture GT-AX11000 Tri-Band 10 Gigabit WiFi Router (RENEWED)

Asus Wireless AC3100 Gigabit Router (RT-AC3100)

ASUS RT-AC68U AiMesh (2 pack) AC1900 Whole Home Dual-band AiMesh Mesh Wifi System, AiProtection Lifetime Security by Trend Micro, Adaptive QoS, Parental Control

ASUS Dual-Band 2x2 AC1300 Super-Fast WiFi 4-Port Gigabit Router with MU-MIMO and USB 3.0 (RT-ACRH13)

ASUS RT-AC1200 V2 AC1200 Dual Band WiFi Router, Easy 3-Step Setup, 4 LAN Ports, VPN, Gaming & Streaming

CYD 65W Powerfast Replacement for Laptop-Charger Asus Zenbook Vivobook Eee Book a53s a53u a450 a52f a53e a54c f551 f554 k401 k501 k55 x401 x450 x501 x502 x550 x551 x552 x554 x555 Power-ac-Adapter

ASUS RT-AC88U Dual-band (2.4 GHz / 5 GHz) Gigabit Ethernet Black,Red 3G 4G

ASUS SRT-AC1900 AC1900 Onhub Google WiFi Router

Asus Wireless AC1200 Dual-Band Router - (RT-AC1200)

ASUS RT-N66R Dual-Band Wireless-N900 Gigabit Router IEEE 802.11a/b/g/n, IEEE 802.3/3u/3ab

ASUS (RT-N16) Wireless-N 300 Maximum Performance single band Gaming Router: Fast Gigabit Ethernet, support USB-Hard Drive and Printer and Open source DDWRT

ASUS RT-N66U Dual-Band Wireless-N900 Gigabit Router

[0306/125211.693:INFO:CONSOLE(0)] "A cookie associated with a cross-site resource at http://yahoo.com/ was set without the `SameSite` attribute. A future release of Chrome will only deliver cookies with cross-site requests if they are set with `SameSite=None` and `Secure`. You can review cookies in developer tools under Application>Storage>Cookies and see more details at https://www.chromestatus.com/feature/5088147346030592 and https://www.chromestatus.com/feature/5633521622188032.", source: https://www.amazon.com/s?k=asus&rh=n%3A300189&nav_sdd=aps&pd_rd_r=58b28d7d-1955-433b-b33b-b1b5dcf1f522&pd_rd_w=MJzan&pd_rd_wg=QG3cj&pf_rd_p=6d81377b-6d6c-4363-ae02-8fa202ed7b50&pf_rd_r=X0BDDAPN7TTW0ZT1REX6&qid=1583290662&ref=sxwds-sbc_c2 (0)
[0306/125211.696:INFO:CONSOLE(0)] "A cookie associated with a cross-site resource at https://yahoo.com/ was set without the `SameSite` attribute. A future release of Chrome will only deliver cookies with cross-site requests if they are set with `SameSite=None` and `Secure`. You can review cookies in developer tools under Application>Storage>Cookies and see more details at https://www.chromestatus.com/feature/5088147346030592 and https://www.chromestatus.com/feature/5633521622188032.", source: https://www.amazon.com/s?k=asus&rh=n%3A300189&nav_sdd=aps&pd_rd_r=58b28d7d-1955-433b-b33b-b1b5dcf1f522&pd_rd_w=MJzan&pd_rd_wg=QG3cj&pf_rd_p=6d81377b-6d6c-4363-ae02-8fa202ed7b50&pf_rd_r=X0BDDAPN7TTW0ZT1REX6&qid=1583290662&ref=sxwds-sbc_c2 (0)

ASUS GT-AC5300 ROG Rapture TriBand 4x4 AC5300 Gaming WiFi Router

ASUS RT-AC87R Wireless-AC2400 Dual Band Gigabit Router

ASUS RT-AC66R 802.11ac Dual-Band Wireless-AC1750 Gigabit Router

ASUS Dual-Band AC750 wireless router 733 Mbps with USB port (RT-AC51U)

NETGEAR Nighthawk X4S Smart WiFi Router (R7800) - AC2600 Wireless Speed (up to 2600 Mbps) | Up to 2500 sq ft Coverage & 45 Devices | 4 x 1G Ethernet, 2 x 3.0 USB, and 1 x eSATA ports

ASUS RT-AC1900 Dual Band WiFi Router

How to remove the CORS line from my output?? Any help would be appreciated!

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
Abhay Salvi
  • 890
  • 3
  • 15
  • 39
  • 2
    So, your question is _not_ about Selenium and not even about _cors_. You have a list of lines and you want to remove the lines that have (or do not have) some property. Everything else simply confuses the readers and makes your question harder to answer, Please update it accordingly. – DYZ Mar 06 '20 at 07:31
  • I want to remove this ```[0306/125211.693:INFO:CONSOLE(0)] "A cookie associated with a cross-site resource at http://yahoo.com/ was set without the `SameSite` attribute.``` Which is related to CORS. Any idea? – Abhay Salvi Mar 06 '20 at 07:33

1 Answers1

1

This error message...

[0306/125211.693:INFO:CONSOLE(0)] "A cookie associated with a cross-site resource at http://yahoo.com/ was set without the `SameSite` attribute.

...is an INFO to spread the word about this new standard to increase developer adoption.

A future release of Chrome will only deliver cookies with cross-site requests if they are set with SameSite=None and Secure. You can review cookies in developer tools under Application>Storage>Cookies and see more details at https://www.chromestatus.com/feature/5088147346030592 and https://www.chromestatus.com/feature/5633521622188032.

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352