I have a Django view function:
def bypass_link(request, pk=None):
instance = fields.objects.get(pk=pk)
link = instance.quote
options = webdriver.ChromeOptions()
driver = webdriver.Chrome(ChromeDriverManager().install(), options=options)
driver.get(link)
driver.find_element_by_id("butAgree").click()
return redirect(link)
template:
<td data-label="Quote">
<a href="{% url 'bypass_link' i.id %}" target="_blank">{{ i.link }}</a>
</td>
urls.py
from django.conf.urls import url
url(r'^bypass_link/(?P<pk>\d+)/$', views.bypass_link, name="bypass_link"),
This opens two links when I click on the hyperlink. When I remove the return redirect(link), this shows the error on the page but the selenium window is working fine.
I just want to open the selenium window when clicking on the hyperlink.
Edits:
I changed the line to return redirect(index), this worked on local. But when I tried this on production, this shows an error. This error was solved if I run selenium in headless mode. But, I don't want to run in headless mode in production. Is it true that Selenium works only in headless mode in production?