how can read text from website ??

+1 vote
from selenium import webdriver
import time

query = ('maps')

if "maps" in query:
    
    driver = webdriver.Firefox()
    driver.get("https://www.google.com/maps/")
    driver.find_element_by_id("searchboxinput").send_keys('surat')
    driver.find_element_by_id("searchbox-searchbutton").click()
    element = driver.find_elements_by_xpath("/html/body/jsl/div[3]/div[9]/div[9]/div/div[1]/div/div/div[10]/h2")
    print(element.text)

#ERROR :::::---AttributeError: 'list' object has no attribute 'text'

# this type of error was shown in the code when i run pls pls pls help me
Jan 6 in Python by anonymous
• 130 points
145 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Python

0 votes
0 answers

How to read lines from compressed text files in Python

Is it easy to read a line ...READ MORE

Dec 27, 2018 in Python by Anirudh
• 2,070 points
108 views
0 votes
1 answer

How can I read numbers in Python from a custom file?

Hi, good question. Let us first assume that ...READ MORE

answered Feb 6, 2019 in Python by Nymeria
• 3,520 points
93 views
0 votes
0 answers

how can i read from a stdin?

can you give an example? READ MORE

Apr 1, 2019 in Python by Waseem
• 4,520 points
45 views
0 votes
0 answers

how can i read a text file in python?

can you specify the syntax and prequisites ...READ MORE

Apr 4, 2019 in Python by Waseem
• 4,520 points
43 views
0 votes
1 answer

How to read data from a text file using Python?

Refer to the below example where the ...READ MORE

answered May 12, 2019 in Python by Sushma
108 views
0 votes
0 answers

How can we read a text file in a list in python?

Can you give the sample code as ...READ MORE

Jun 18, 2019 in Python by Waseem
• 4,520 points
27 views
0 votes
1 answer

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,510 points
1,570 views
0 votes
1 answer
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,870 points
1,501 views
0 votes
1 answer

How to use such xpath to find web elements

It's much simpler to use: #MyDiv123 > div.super or ...READ MORE

answered Jun 14, 2018 in Selenium by Samarpit
• 5,870 points
1,283 views