0
from selenium import webdriver           
import time
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
from webdriver_manager.chrome import ChromeDriverManager
from bs4 import BeautifulSoup
import pandas as pd
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
from selenium.webdriver.support.wait import WebDriverWait
import requests
from csv import writer


options = webdriver.ChromeOptions()
options.add_argument("--no-sandbox")
options.add_argument("--disable-gpu")
options.add_argument("--window-size=1920x1080")
options.add_argument("--disable-extensions")
driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()))
wait = WebDriverWait(driver, 20) 

time.sleep(2)
url='https://app.vidiq.com/auth/login'

driver.get(url)

email=driver.find_element(By.CSS_SELECTOR,"input#email")
email.send_keys("----------")

password=driver.find_element(By.CSS_SELECTOR,"input#password")
password.send_keys("-------")

time.sleep(2)
login=driver.find_element(By.XPATH,"//button[@type='submit']")
login.click()

time.sleep(30)


element = WebDriverWait(driver,30).until(EC.presence_of_element_located((By.XPATH, "//div[@id='research-link']//span")))
element.click()

I want to click on the keyword but they will not click on it Kindly suggest to me what I am doing wrong here then the program will end so is there issue in my xpath

This is the XPath I made for keyword so is there my xpath are correct

element = WebDriverWait(driver,30).until(EC.presence_of_element_located((By.XPATH, "//div[@id='research-link']//span")))element.click()
element.click()

Error they show me

ERROR: Couldn't read tbsCertificate as SEQUENCE
ERROR: Failed parsing Certificate

[4232:16160:0310/163027.484:ERROR:cert_issuer_source_aia.cc(34)] Error parsing cert retrieved from AIA (as DER):
ERROR: Couldn't read tbsCertificate as SEQUENCE
ERROR: Failed parsing Certificate

enter image description here

Amen Aziz
  • 153
  • 6

2 Answers2

2

Regarding the tbsCertificate error, add the below line: This will ignore those errors.

options = webdriver.ChromeOptions()
options.add_experimental_option('excludeSwitches', ['enable-logging'])

Coming to your next issue, which is trying to locate the "Keywords" element. Try this Xpath expression:

(//div[@id='research-link']//span)[1]

Code should be:

element = WebDriverWait(driver,30).until(EC.presence_of_element_located((By.XPATH, "(//div[@id='research-link']//span)[1]")))
element.click()

Or:

WebDriverWait(driver,30).until(EC.element_to_be_clickable((By.XPATH, "(//div[@id='research-link']//span)[1]")))
element.click()

You can even try using below XPath expression: This expression searches all the span nodes which contain text "Keywords"

//span[text()='Keywords']
Shawn
  • 4,064
  • 2
  • 11
  • 23
  • they show these error `[7284:15376:0310/162526.324:ERROR:cert_issuer_source_aia.cc(34)] Error parsing cert retrieved from AIA (as DER): ERROR: Couldn't read tbsCertificate as SEQUENCE ERROR: Failed parsing Certificate` – Amen Aziz Mar 10 '23 at 11:26
  • This error has nothing to do with finding the desired element. Can you update your question with full error stack trace? – Shawn Mar 10 '23 at 11:29
  • I have add full error in my question – Amen Aziz Mar 10 '23 at 11:33
  • 1
    Check the updated answer. Add this code `options.add_experimental_option('excludeSwitches', ['enable-logging'])`. Let me know the status. – Shawn Mar 10 '23 at 11:43
  • I add these lines but the same error shows me again........... – Amen Aziz Mar 10 '23 at 15:59
  • Thanks the error is solve now – Amen Aziz Mar 10 '23 at 16:51
  • You are welcome. Upvote and accept the answer if this has resolved your issue. – Shawn Mar 10 '23 at 16:52
1

To identify the Keyword element, Use either of the xpath

1.

//div[@id='research-link']//span[text()='Keywords']

or 2.

//a[.//span[text()='Keywords']]
KunduK
  • 32,888
  • 5
  • 17
  • 41