The error while creating a object of browser

if my jupyter notebook is opened on microsoft edge and i am installing the chrome driver and working on edge. my line browser object showing an error

Hey @Aashi-Agarwal-2380268668952871, what is the error you are getting ? Can you please post a screenshot of it ? Also I would suggest you to try using microsoft edge driver only, since you are working on edge.

Hope this helps !
Happy Learning :slight_smile:

this is the line i have wrote.
#now create a browser object
browser= webdriver.Edge(ā€œC:\Users\Aashi Agarwal\Desktopā€)
this is the error i have got.
File ā€œā€, line 2
browser= webdriver.Edge(ā€œC:\Users\Aashi Agarwal\Desktopā€)
^
SyntaxError: (unicode error) ā€˜unicodeescape’ codec can’t decode bytes in position 2-3: truncated \UXXXXXXXX escape

Hey @Aashi-Agarwal-2380268668952871, microsoft edge have all different syntaxes, I would suggest you to switch your default browser to chrome. Still if you want to continue with edge only then you can refer to this documentation.

Hope this helps !
Happy Coding :slight_smile:

how to switch default browser as chrome?

You just need to download chrome(any latest version) and then download the chrome drivers following the method taught by sir in the video.

i have chrome downloaded and also its drivers. but my jupyter always open on edge

Did you try using the chrome drivers exactly by following the steps in the video ? Does it give any error ?

#now create a browser object
browser= webdriver.Chrome(ā€œC:\Users\Aashi Agarwal\Desktopā€)
look the error is same
File ā€œā€, line 2
browser= webdriver.Chrome(ā€œC:\Users\Aashi Agarwal\Desktopā€)
^
SyntaxError: (unicode error) ā€˜unicodeescape’ codec can’t decode bytes in position 2-3: truncated \UXXXXXXXX escape

The path you gave is not correct I guess. It should be something like this :

browser = webdriver.Chrome('/Users/aayushkhurana/Desktop/chromedriver')

Try this. I hope you have placed your unzipped chromedriver on the desktop.

1 Like