Home>
# get element with selenium
driver.find_elements_by_class_name ('wrap_box') [2] .find_elements_by_tag_name ('article')
# I want to combine the 10 elements that I got into text
(<selenium.webdriver.remote.webelement.WebElement (session = "c5478f098015ed3c442d6f9a2a200d5a", element = "981d9fa1-7aa7-4f03-9191-9d8424ea1f15")>,
<selenium.webdriver.remote.webelement.WebElement (session = "c5478f098015ed3c442d6f9a2a200d5a", element = "d8ab2b29-ad93-4a1e-a62c-5678e3bb3baa")>,
<selenium.webdriver.remote.webelement.WebElement (session = "c5478f098015ed3c442d6f9a2a200d5a", element = "e4d5558c-c5a6-49eb-aafa-7e1903e5061f")>,
<selenium.webdriver.remote.webelement.WebElement (session = "c5478f098015ed3c442d6f9a2a200d5a", element = "3d48e296-23b1-4ae6-9fa6-0d6718618e51")>,
<selenium.webdriver.remote.webelement.WebElement (session = "c5478f098015ed3c442d6f9a2a200d5a", element = "ca920fa7-4ee3-4044-910e-7621dbf4eb4a")>,
<selenium.webdriver.remote.webelement.WebElement (session = "c5478f098015ed3c442d6f9a2a200d5a", element = "a4d1fb42-9bec-4492-9870-50a942478784")>,
<selenium.webdriver.remote.webelement.WebElement (session = "c5478f098015ed3c442d6f9a2a200d5a", element = "b086f1eb-ffac-424e-be45-83c2a13afcba")>,
<selenium.webdriver.remote.webelement.WebElement (session = "c5478f098015ed3c442d6f9a2a200d5a", element = "5a9bd3bd-13b2-4728-aeb3-23d327902793")>,
<selenium.webdriver.remote.webelement.WebElement (session = "c5478f098015ed3c442d6f9a2a200d5a", element = "4f1abc9d-03cf-461e-84db-24bf89cfe7cd")>,
<selenium.webdriver.remote.webelement.WebElement (session = "c5478f098015ed3c442d6f9a2a200d5a", element = "98ae5249-1dd6-4c20-b136-2fa8f51201df")>]
# It is possible to loop by for statement and combine it by adding text and adding
text = ''
for i in driver.find_elements_by_class_name ('wrap_box') [2] .find_elements_by_tag_name ('article'):
text + = i.text
We are considering a combination method other than the above, but we have not been able to find it.
- join () can only handle strings
- If i convert the acquired element to str type with map (), it will not be possible to convert it to text
I'm sure it's a nasty question, but I'd be happy if you could tell me.
Thanks for your cooperation.
-
Answer # 1
Related articles
- python - i want to get multiple elements with selenium
- some elements cannot be clicked in python selenium (chrome)
- python - about pythinista3 selenium browser controls
- when graphing a list with matplotlib in python, the number of elements is large and the graph is not displayed
- processing using the len function when an integer value is obtained from python standard input
- python - combine input with built-in functions
- python - i want to combine two dfs
- about moving to another page with python selenium
- python - i'm using selenium the text sent by send_keys to the input tag disappears when the text is sent by send_key to the next
- python - i want to handle files with the path obtained by ospathjoin
- python - i want to convert the characters obtained from the txt file to numbers
- (python) i would like to know how to combine an int value and a multidimensional array
- python - kivy: to refer to other widget elements
- i want to combine lists with python
- python - i want to get the elements in the linked site
- python - combination/multiplication of list elements
- python - array elements cannot be used as function arguments ??
- website button clicks in selenium and python
- [python] i can't open a new firefox tab in selenium a new window will open
- python - [selenium] click the radio button
Related questions
- python 3x - about the contents of python error code
- [python] [selenium] css pseudo-element state acquisition
- python 3x - bring the chrome window opened in selenium to the front
- python 3x - i can't get the text of the span tag using selenium
- python - i made a code to search a website tag as a string, but can it be simplified?
- python - i want to search only a part of html (a certain selector) with find_all of beautifulsoup
- python - i'm using selenium the text sent by send_keys to the input tag disappears when the text is sent by send_key to the next
- python - the library installed by pip cannot be imported no module named'selenium'
- internet explorer - i am testing using selenium (ie11), but i cannot clear the cookie i entered last time
- python - find_element_by_id method error
You should combine comprehensions and joins.
If the text of each article element is a, b, c, ...
The output result of print is a connection, connection b, connection c, y connection z.
If you don't want to use letters to connect, change "Connect" to "".