I'm thinking of creating a tool that automatically obtains information from JplatPat of the Patent Office using Python and Selenium.
I'm making a tool by automatically creating Python code using SeleniumIDE.
In Jplatpat, set the publication number to "2011-161271", click and click
The link of "Japanese Patent Laid-Open No. 2011-161271" was successfully displayed.
So I want to click that link to bring up another window,
I can't do that.
The error message is below.
runfile ('C: /Users/ksclu/.spyder-py3/test.py', wdir ='C: /Users/ksclu/.spyder-py3')
Traceback (most recent call last):
File "C: \ Users \ ksclu \ .spyder-py3 \ test.py", line 32, in
element = driver.find_element_by_link_text ("Japanese Patent Laid-Open No. 2011-161271")
File "C: \ Users \ ksclu \ anchorda3 \ lib \ site-packages \ selenium \ webdriver \ remote \ webdriver.py", line 428, in find_element_by_link_text
return self.find_element (by = By.LINK_TEXT, value = link_text)
File "C: \ Users \ ksclu \ anaconda3 \ lib \ site-packages \ selenium \ webdriver \ remote \ webdriver.py", line 978, in find_element
'value': value}) ['value']
File "C: \ Users \ ksclu \ anaconda3 \ lib \ site-packages \ selenium \ webdriver \ remote \ webdriver.py", line 321, in execute
self.error_handler.check_response (response)
File "C: \ Users \ ksclu \ anaconda3 \ lib \ site-packages \ selenium \ webdriver \ remote \ errorhandler.py", line 242, in check_response
raise exception_class (message, screen, stacktrace)
NoSuchElementException: no such element: Unable to locate element: {"method": "link text", "selector": "Japanese Patent Laid-Open No. 2011-161271"}
(Session info: chrome = 87.0.4280.66)
The language is Python.
The source code is below.
import pytest
import time
import json
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
import chromedriver_binary # code to pass
driver = webdriver.Chrome () #Prepare Chrome
vars = {}
driver.find_element (By.ID, "p00_srchCondtn_txtDocNoInputNo1"). click ()
driver.find_element (By.ID, "p00_srchCondtn_txtDocNoInputNo1"). send_keys ("2011-161271")
driver.find_element (By.CSS_SELECTOR, "# p00_searchBtn_btnDocInquiry>span"). click ()
element = driver.find_element_by_link_text ("Japanese Patent Laid-Open No. 2011-161271")
element.click () What I tried
It seems that the usage of driver.find_element_by_link_text is not good.
I've tried using Xpath, but it doesn't work.
Nothing in particular.
Please write your question in detail here.
(Example) I am making a ●● system with PHP (CakePHP).
■■ The following error message occurred while implementing the function.
Error message
Corresponding source code
Source code
What I tried
Please describe here what you have tried for the problem.
Supplementary information (FW/tool version, etc.)Please provide more detailed information here.
-
Answer # 1
Related articles
- parallel processing using python multiprocessingpool and multiprocessingqueue does not work well
- python - aggregation processing using pandas
- python - websocket processing using asyncio
- i don't understand the exercises using python trigonometric functions
- processing python dat files
- python - about multiple processing and loop processing in discordpy
- processing using the len function when an integer value is obtained from python standard input
- about external libraries when using multiple versions of python
- python - i want to separate by a specific word using the split function
- python - image recognition using cnn keras multiple inputs
- about batch change of file name using python
- python - speech processing typeerror:'int' object is not subscriptable
- python - chrome driver does not open on mac
- python - tkinter parallel processing
- about processing to exclude the character string group specified from list in python
- python 3x - i want to get the nth array with an argument using python3 argparse
- python:about processing such as timesleep and wxpython
- python 3x - how to rename a folder created using jupyternotebook
- python - error in image binarization using cv2adaptivethreshold function
Is
PostscriptJP 2011-161271
likea
It means to select a tag, but is it correct?Are there spaces before and after the text?
time.sleep (1)
Let's put in.If the program runs on the server side and returns the page instead of following a simple link, it's better to wait a moment.