When automating a click () new tab is opened.
-
Expected situation:
use command to change tab, start actions within the new tab.
-
What happens:
I can not perform any action on the new tab. (site problem?)
Follow the code:
from selenium import webdriver as wd
from selenium.webdriver.common.keys import Keys
from bs4 import BeautifulSoup as bs
import time
import requests
class Site:
def __init__(self, driver):
self.driver = driver
self.url = "http://fomentonacional.cnpq.br/dmfomento/home/fmtvisualizador.jsp?UA=301&Facil=S&Visualizar=S&Corte1" \
"=017&Filtro1=Apoio%20%E0%20Projeto%20de%20Pesquisa&Corte2=021&Filtro2=2018&Corte3=001"
def navigate(self):
self.driver.get(self.url)
def search(self, word='None'):
self.driver.find_element_by_xpath('/html/body/form[1]/fieldset[2]/ul/li[3]/table/tbody[6]/tr/td[2]/b/a')
def click(self):
self.driver.find_element_by_xpath('/html/body/form[1]/fieldset[2]/ul/li[3]/table/tbody[6]/tr/td[2]/b/a').click()
ff = wd.Chrome('/home/nyx/bin/chromedriver')
site = Site(ff)
site.navigate()
site.search()
time.sleep(3)
site.click()