Skip to content

Commit e3d24ae

Browse files
UI Init
1 parent 047679b commit e3d24ae

File tree

7 files changed

+132
-31
lines changed

7 files changed

+132
-31
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.exe
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import requests
2+
from lxml import html
3+
import string
4+
5+
url = "https://www.reddit.com/r/popular/?geo_filter=US"
6+
page = requests.get(url)
7+
tree = html.fromstring(page.content)
8+
9+
token = tree.xpath('//a[@href]')
10+
print(token)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
from selenium import webdriver
2+
from selenium.webdriver.common.keys import Keys
3+
from selenium.webdriver.common.by import By
4+
5+
driver = webdriver.Firefox(executable_path=r'H:\Github\PythonScripts\PyQtDesigner\WebScrapper\geckodriver.exe')
6+
# driver.implicitly_wait(10)
7+
driver.get("https://internshala.com/internships/computer%20science-internship-in-mumbai")
8+
9+
# elems = driver.find_elements_by_xpath("//a[@href]")
10+
# for elem in elems:
11+
# print (elem.get_attribute("href"))
12+
13+
#elems = driver.find_elements_by_css_selector('div.individual_internship_details')
14+
15+
# print(elems)
16+
17+
for e in elems:
18+
print(e.text)
19+
20+
driver.close()
21+
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
from selenium import webdriver
2+
from selenium.webdriver.support.ui import WebDriverWait
3+
4+
driver = webdriver.Firefox(executable_path=r'H:\Github\PythonScripts\PyQtDesigner\WebScrapper\geckodriver.exe')
5+
driver.get("https://www.tatacliq.com/global-desi-navy-embroidered-kurta/p-mp000000000876745")
6+
driver.set_page_load_timeout(45)
7+
driver.maximize_window()
8+
driver.implicitly_wait(2)
9+
driver.get_screenshot_as_file("D:\\Tatacliq.png")
10+
print ("Executed Succesfull")
11+
# driver.find_element_by_xpath("//div[@class='pdp-promo-title pdp-title']").click()`enter code here`
12+
# SpecialPrice =driver.find_element_by_xpath("//div[@class='pdp-promo-title pdp-title']").text
13+
# print(SpecialPrice)
14+
driver.close()
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
1. Get site url
2+
2. Get first or all instance
3+
4+
3. Get by element by id use # // driver.find_element_by_class_id('')
5+
4. get by element by class use . // driver.find_element_by_class_name('')
6+
5. Get by TagName // driver.find_element_by_tag_name('')
7+
6. Get by Name // driver.find_element_by_name('')
8+
7. Get by CSS selectors // driver.find_element_by_css_selector('p.content')
9+
10+
8. Get by Xpath - driver.find_elements_by_xpath("//a[@href]")
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
from PyQt5 import QtCore, QtGui, QtWidgets , uic
2+
from PyQt5.QtGui import QIcon
3+
import os
4+
import sys
5+
6+
class Web(QtWidgets.QMainWindow):
7+
def __init__(self):
8+
super(Web,self).__init__()
9+
scriptDir = os.path.dirname(os.path.realpath(__file__))
10+
uic.loadUi(scriptDir + os.path.sep + 'WebScrapper.ui',self)
11+
self.setWindowIcon(QIcon(scriptDir + os.path.sep + 'python-logo.png'))
12+
self.setWindowTitle('WebScrapper by [@Nishant Ghanate]')
13+
14+
15+
if __name__ == "__main__":
16+
app = QtWidgets.QApplication(sys.argv)
17+
web = Web()
18+
web.show()
19+
sys.exit(app.exec_())

PyQtDesigner/WebScrapper/WebScrapper.ui

Lines changed: 57 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@
2323
<height>381</height>
2424
</rect>
2525
</property>
26+
<property name="font">
27+
<font>
28+
<pointsize>10</pointsize>
29+
</font>
30+
</property>
2631
</widget>
2732
<widget class="QPushButton" name="pushButton">
2833
<property name="geometry">
@@ -33,6 +38,11 @@
3338
<height>41</height>
3439
</rect>
3540
</property>
41+
<property name="font">
42+
<font>
43+
<pointsize>10</pointsize>
44+
</font>
45+
</property>
3646
<property name="text">
3747
<string>Load url</string>
3848
</property>
@@ -43,19 +53,29 @@
4353
<x>810</x>
4454
<y>60</y>
4555
<width>491</width>
46-
<height>551</height>
56+
<height>501</height>
4757
</rect>
4858
</property>
59+
<property name="font">
60+
<font>
61+
<pointsize>10</pointsize>
62+
</font>
63+
</property>
4964
</widget>
5065
<widget class="QPushButton" name="pushButton_2">
5166
<property name="geometry">
5267
<rect>
5368
<x>500</x>
54-
<y>580</y>
69+
<y>560</y>
5570
<width>91</width>
5671
<height>41</height>
5772
</rect>
5873
</property>
74+
<property name="font">
75+
<font>
76+
<pointsize>10</pointsize>
77+
</font>
78+
</property>
5979
<property name="text">
6080
<string>Get source</string>
6181
</property>
@@ -69,26 +89,41 @@
6989
<height>41</height>
7090
</rect>
7191
</property>
92+
<property name="font">
93+
<font>
94+
<pointsize>12</pointsize>
95+
</font>
96+
</property>
7297
</widget>
7398
<widget class="QTextEdit" name="textEdit_2">
7499
<property name="geometry">
75100
<rect>
76101
<x>30</x>
77-
<y>580</y>
102+
<y>560</y>
78103
<width>431</width>
79104
<height>41</height>
80105
</rect>
81106
</property>
107+
<property name="font">
108+
<font>
109+
<pointsize>12</pointsize>
110+
</font>
111+
</property>
82112
</widget>
83113
<widget class="QPushButton" name="pushButton_3">
84114
<property name="geometry">
85115
<rect>
86116
<x>1190</x>
87-
<y>640</y>
117+
<y>610</y>
88118
<width>111</width>
89119
<height>41</height>
90120
</rect>
91121
</property>
122+
<property name="font">
123+
<font>
124+
<pointsize>10</pointsize>
125+
</font>
126+
</property>
92127
<property name="text">
93128
<string>Clear logs</string>
94129
</property>
@@ -97,39 +132,18 @@
97132
<property name="geometry">
98133
<rect>
99134
<x>810</x>
100-
<y>640</y>
135+
<y>610</y>
101136
<width>101</width>
102137
<height>41</height>
103138
</rect>
104139
</property>
105-
<property name="text">
106-
<string>Save Logs</string>
107-
</property>
108-
</widget>
109-
<widget class="QRadioButton" name="radioButton">
110-
<property name="geometry">
111-
<rect>
112-
<x>40</x>
113-
<y>550</y>
114-
<width>101</width>
115-
<height>17</height>
116-
</rect>
140+
<property name="font">
141+
<font>
142+
<pointsize>10</pointsize>
143+
</font>
117144
</property>
118145
<property name="text">
119-
<string>First Occurence</string>
120-
</property>
121-
</widget>
122-
<widget class="QRadioButton" name="radioButton_2">
123-
<property name="geometry">
124-
<rect>
125-
<x>160</x>
126-
<y>550</y>
127-
<width>101</width>
128-
<height>17</height>
129-
</rect>
130-
</property>
131-
<property name="text">
132-
<string>All Occurence</string>
146+
<string>Save Logs</string>
133147
</property>
134148
</widget>
135149
</widget>
@@ -142,8 +156,20 @@
142156
<height>21</height>
143157
</rect>
144158
</property>
159+
<widget class="QMenu" name="menuGuide">
160+
<property name="title">
161+
<string>Setting</string>
162+
</property>
163+
<addaction name="actionGuide"/>
164+
</widget>
165+
<addaction name="menuGuide"/>
145166
</widget>
146167
<widget class="QStatusBar" name="statusbar"/>
168+
<action name="actionGuide">
169+
<property name="text">
170+
<string>Guide</string>
171+
</property>
172+
</action>
147173
</widget>
148174
<resources/>
149175
<connections/>

0 commit comments

Comments
 (0)