Python Selenium is redirecting the URL to Sign up page
<p>I have the following code:</p>

<pre><code>&gt; from selenium import webdriver
&gt; browser = webdriver.Chrome(executable_path =
 r"C:\Users\ABC\AppData\Local\Programs\Python\Python35-32\Lib\site-packages\selenium\webdriver\common\chromedriver.exe")
&gt; browser.get('http://www.linkedin.com/pub/dir/?first=jatin&amp;last=wadhwa&amp;trk=prof-samename-search-submit')
&gt; print (browser.page_source)
</code></pre>

<p>What's happening is I want to open In spite of ->
 <a href="http://www.linkedin.com/pub/dir/?first=jatin&amp;last=wadhwa&amp;trk=prof-samename-search-submit" rel="nofollow">http://www.linkedin.com/pub/dir/?first=jatin&amp;last=wadhwa&amp;trk=prof-samename-search-submit</a></p>

<p>it is going -></p>

<p><a href="https://www.linkedin.com/start/join?session_redirect=http%3A%2F%2Fwww.linkedin.com%2Fpub%2Fdir%2F%3Ffirst%3Djatin%26last%3Dwadhwa%26trk%3Dprof-samename-search-submit&amp;source=sentinel_org_block&amp;trk=login_reg_redirect" rel="nofollow">https://www.linkedin.com/start/join?session_redirect=http%3A%2F%2Fwww.linkedin.com%2Fpub%2Fdir%2F%3Ffirst%3Djatin%26last%3Dwadhwa%26trk%3Dprof-samename-search-submit&amp;source=sentinel_org_block&amp;trk=login_reg_redirect</a></p>

<p>Any solution so that it opens the desired link not the redirected one?</p>

<p>Linkedin does not search page without login. First login on linkedin then you can scrape data. </p>

<pre><code>browser.get('https://www.linkedin.com/')
elem = browser.find_element_by_name('session_key')
elem.clear()
elem.send_keys(email_id) # enter your email id or phone number

elem = browser.find_element_by_name('session_password')
elem.clear()
elem.send_keys(password) # enter your linkedin password

submit = browser.find_element_by_xpath('//*[@id="pagekey-uno-reg-guest-home"]/div[1]/div/form/input[6]')
actions = ActionChains(browser)
actions.click(submit)
actions.perform() # after this you will be login

# Now you can open url without redirecting

browser.get(`'http://www.linkedin.com/pub/dir/?first=jatin&amp;last=wadhwa&amp;trk=prof-samename-search-submit')`
</code></pre>

python session selenium