How i extract text from a model dialog in selenium?

Sudhanshu Prajapati

I'm trying to scrape data from "https://free-proxy-list.net/" to simply extract data by clicking on "Get raw list" which opens up a model box inside a website and from that, you can easily copy that or extract that data. So I tried to extract that text using normally

driver.find_element_by_xpath().text

but it showed me an error

ElementNotVisibleException: Message: element not interactable

I followed this answer https://stackoverflow.com/a/54618973/8197487 to overcome this problem

WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH,'//*[@id="list"]/div/div[1]/ul/li[6]/a'))).click()

p=WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH,'//*[@id="raw"]/div/div/div[2]/textarea'))).text

After using the above code no error raises but I get no text.

is there any other way or I'm doing something wrong.

frianH

Try the below code:

driver.get('https://free-proxy-list.net/')
get_raw = WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, 'a[title="Get raw list"]')))
get_raw.click()
popup = WebDriverWait(driver, 20).until(EC.visibility_of_element_located((By.CSS_SELECTOR, 'div.modal-body textarea')))
print(popup.get_attribute('value'))
driver.quit()

Output:

Free proxies from free-proxy-list.net
Updated at 2020-06-11 18:52:02 UTC.

167.172.191.249:39193
51.77.149.1:3134
2.50.154.155:53281
213.6.227.38:54796
122.248.45.35:53281
173.46.67.172:58517
1.186.151.206:36253
182.16.171.65:30679
80.237.20.20:41824
45.225.204.8:999
195.239.178.110:59921
46.41.135.121:8118
5.58.85.32:44937
12.218.209.130:53281
197.89.175.235:8080
119.2.54.204:42510
114.5.128.18:41577
54.169.9.36:3128
199.247.6.29:8080
202.162.196.167:8080
213.98.67.40:41005
103.25.57.83:3128
5.160.72.147:55206
45.230.8.20:51200
191.235.239.149:8080
115.75.1.156:38351
202.57.55.178:60253
209.190.32.28:3128
31.179.224.42:38263
117.103.5.186:44825
85.238.167.170:40088
173.249.30.197:8118
36.72.70.13:8080
13.125.52.156:3128
91.207.147.243:38472
188.92.15.63:59563
3.6.251.241:80
45.236.171.82:999
153.127.6.218:80
176.104.105.218:49141
167.71.91.204:8080
91.134.232.63:3128
103.206.246.214:8080
159.65.171.69:80
223.27.147.121:57726
181.115.168.69:49076
1.179.148.9:61904
159.224.44.19:35697
191.235.104.63:8080
45.64.99.26:8080
183.88.193.179:8080
202.61.49.52:61818
85.223.157.204:40329
167.172.136.107:80
143.0.245.9:39137
103.6.104.105:38898
156.67.117.66:8080
114.57.189.82:54906
217.23.69.146:8080
36.92.57.235:55443
213.0.106.138:3128
130.185.238.103:8080
103.106.219.119:8080
109.238.222.5:45313
41.85.191.6:57797
105.27.237.28:80
142.11.215.136:1321
190.12.95.170:31260
103.31.227.27:8080
105.29.64.221:80
217.61.21.73:3128
159.203.44.118:8080
188.133.165.206:56145
45.235.163.35:33265
103.66.47.97:8080
119.82.252.122:36182
45.71.80.2:59598
178.218.104.8:49707
200.0.46.50:37232
197.242.206.105:59173
1.2.169.49:36335
1.10.188.203:45476
77.48.23.199:57842
45.235.87.65:53781
118.172.51.110:36552
177.66.255.9:51851
103.106.192.166:44689
216.169.73.65:49627
103.29.222.231:52030
184.90.114.134:3128
31.131.67.14:8080
188.235.8.5:54689
46.150.170.10:53281
187.62.191.3:61456
103.87.169.159:31094
190.210.15.194:32302
83.69.93.64:44331
110.77.228.106:8080
94.180.106.94:32767
118.173.233.31:59669
78.186.111.109:8080
154.73.137.157:48896
95.80.98.41:8080
51.158.22.63:5836
178.219.31.252:8080
212.129.55.209:5836
190.111.248.212:8085
213.92.182.235:8080
114.110.21.121:50464
101.51.141.49:57977
125.26.99.212:51591
119.82.253.63:34110
177.84.242.226:54458
188.27.137.163:30987
95.84.137.193:53281
43.229.25.73:38896
202.152.38.77:52740
91.202.240.208:51678
180.250.153.130:53281
118.175.240.205:45232
185.56.209.114:51386
118.97.235.234:8080
61.19.40.50:33665
103.57.143.229:61148
92.52.186.123:32329
79.127.110.29:53293
14.162.145.116:30762
111.235.65.211:35949
193.95.228.13:53281
180.211.183.178:37850
94.243.140.162:40960
200.25.254.135:56897
1.20.97.96:54205
123.200.20.242:58847
187.60.36.164:53597
124.41.243.72:44716
45.188.156.154:8080
90.189.209.127:80
115.127.109.2:45067
187.178.4.242:34125
118.174.196.112:36314
202.77.120.38:57716
109.248.62.207:51672
186.29.163.97:49787
202.179.21.49:23500
178.93.59.22:61135
1.10.189.156:34899
185.100.13.72:47382
176.62.188.158:56351
195.209.176.2:8080
103.141.108.237:3128
12.139.101.99:80
31.28.228.252:8080
36.67.68.21:59436
184.75.210.62:80
1.10.187.149:44976
91.220.166.148:39915
12.139.101.100:80
36.66.19.10:8080
40.121.198.48:80
95.158.63.46:54597
103.28.121.58:3128
194.187.150.40:3128
103.35.132.50:36555
46.197.209.217:3128
103.129.195.108:54033
94.237.75.117:80
176.98.76.203:36651
177.91.127.56:41941
43.229.25.128:52893
88.119.54.44:41382
190.90.63.111:49225
147.78.160.2:8080
91.67.240.45:3128
190.103.178.15:8080
186.42.124.130:65301
178.205.254.106:8080
176.235.99.33:33976
118.174.65.137:31682
14.207.57.235:3128
159.138.3.119:443
45.236.88.42:8880
159.138.1.185:80
105.29.64.217:80
185.134.23.198:80
189.14.193.242:53281
5.9.56.112:3128
144.91.92.67:3128
105.29.64.222:80
64.227.126.52:3128
185.138.123.78:55337
112.78.143.26:47718
5.189.133.231:80
36.67.24.109:37641
92.112.49.152:8080
41.50.139.238:8080
183.89.43.235:8080
36.69.49.246:8080
195.154.47.39:5836
190.80.11.32:8080
113.161.186.101:8080
183.88.195.185:8080
41.60.237.63:8080
181.78.12.133:999
61.91.100.34:8080
181.113.135.254:52058
103.240.206.152:55740
185.141.38.164:51834
41.217.217.60:58734
85.10.219.100:1080
91.150.189.122:43102
93.109.241.246:51587
91.211.107.204:41258
177.73.188.110:54459
219.94.220.147:80
45.71.80.1:51460
200.35.56.161:35945
77.55.214.240:80
5.196.255.171:3128
95.31.5.29:54651
183.182.101.32:56814
46.20.59.243:47497
195.4.164.127:8080
113.161.116.94:8080
81.163.51.69:53281
81.144.138.35:3128
194.183.168.129:31385
189.204.241.42:56792
94.141.233.66:53171
170.82.253.146:53281
103.216.82.190:6666
46.221.57.62:31740
190.200.191.171:8080
79.143.225.152:34155
187.109.118.27:45065
41.160.40.2:37741
95.65.73.200:60952
45.91.94.134:8080
85.21.63.219:53281
185.23.128.180:3128
212.95.180.50:53281
202.51.68.14:61361
138.122.140.18:3128
203.153.20.64:53281
182.52.90.117:45535
1.20.101.62:39928
95.80.254.162:53295
36.255.234.243:46857
91.192.7.36:53281
49.248.154.233:80
138.122.8.49:40818
36.89.180.103:61867
132.255.92.34:53281
31.173.94.93:31504
91.207.238.107:40071
1.20.97.173:46790
125.26.7.124:61642
118.175.93.148:55169
62.122.201.241:46176
177.46.148.142:3128
96.87.16.153:41344
187.130.139.197:8080
81.3.175.15:8080
110.44.133.135:3128
114.199.111.162:80
89.216.48.230:44061
103.215.177.180:80
185.159.87.102:6660
65.152.119.226:39408
114.5.35.98:38554
109.73.181.228:46352
89.36.195.238:39131
185.141.38.93:47607
180.243.67.2:8080
13.66.88.8:3128
182.253.82.156:35955
59.153.18.170:53281
169.239.223.136:49337
186.125.59.8:44363
103.245.182.1:8080
103.95.40.2:8080
62.112.118.14:8080
212.83.175.206:5836
103.42.255.145:50344
5.59.145.129:8080
94.228.85.166:38510
111.220.90.41:40938
188.226.141.211:3128
51.68.228.131:80
110.74.219.189:42074
128.199.202.122:3128
200.106.55.125:80
139.162.78.109:8080
181.196.151.82:45717
124.41.211.188:37746
85.10.219.103:1080
119.81.189.194:80
123.63.110.23:80
182.53.197.156:30082
167.71.5.83:8080

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related