Skip to content

Commit

Permalink
0.1.6
Browse files Browse the repository at this point in the history
  • Loading branch information
yasserbdj96 authored May 29, 2022
1 parent 99e7b79 commit 7c97ffc
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 11 deletions.
13 changes: 12 additions & 1 deletion CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
## 0.1.6 [29-05-2022]
- Fix bugs.

## 0.1.5 [28-05-2022]
- Add sleep.
- Fix bugs.

## 0.1.3 [28-05-2022]
- Add Return 'get_attribute' as a list.
- Fix bugs.

## 0.1.2 [10-03-2022]
- Fix bugs.

Expand All @@ -8,4 +19,4 @@
- New build.

## 0.0.1
- First public release.
- First public release.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,13 @@ p2.end()
<h2>Changelog History:</h2>

```
## 0.1.6 [29-05-2022]
- Fix bugs.
## 0.1.5 [28-05-2022]
- Add sleep.
- Fix bugs.
## 0.1.3 [28-05-2022]
- Add Return 'get_attribute' as a list.
- Fix bugs.
Expand Down
3 changes: 2 additions & 1 deletion examples/examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"url":"<WEBSITE_URL>",
"<OPIRATION_TITLE>":{
"operations":[
{"type":"<xpath/link_text/id/name/tag_name>","code":"<ELEMENT_CODE>","arg_code":"[n]","opt":"<click/put/get>","arg_data":"[n]","data":"<YOUR_DATA>"}
{"type":"<xpath/link_text/id/name/tag_name>","code":"<ELEMENT_CODE>","arg_code":"[n]","opt":"<click/put/get>","arg_data":"[n]","data":"<YOUR_DATA>","sleep":<Seconds>}
]
}
}
Expand All @@ -18,6 +18,7 @@
# 'arg_data' and 'arg_code' are numbers.
# 'arg_data' and 'arg_code' are the order of the element to be inserted from the list. //Example: p1.run(<OPIRATION_TITLE>,n0,n1,n2....n)
# 'data' and 'code' for entering data like password or username from json file (this is a common option if the variables you want to use are static).
# 'sleep' To wait for a certain period before starting an operation.
"""

Expand Down
15 changes: 11 additions & 4 deletions examples/google.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
{
"url":"https://www.google.com/",
"url":"https://www.google.com",
"search":{
"operations":[
{"type":"xpath","code":"/html/body/c-wiz/c-wiz/div/div[3]/div[2]/div/div[1]/form/div[1]/div[1]/c-wiz/div/a","opt":"click"},
{"type":"xpath","code":"/html/body/div[1]/div[1]/div/div/div/div[1]/div/div[2]/a","opt":"click"},
{"type":"xpath","code":"/html/body/div[1]/div[3]/form/div[1]/div[1]/div[1]/div/div[2]/input","opt":"put","arg_data":"0"},
{"type":"name","code":"btnK","opt":"click"},
{"type":"xpath","code":"/html/body/div[7]/div/div[4]/div/div[1]/div/div[1]/div/div[2]/a","opt":"click"},
{"type":"xpath","code":"/html/body/div[1]/div[3]/form/div[1]/div[1]/div[1]/button","opt":"click"},

{"type":"xpath","code":"/html/body/div[2]/c-wiz/div[1]/div/div[1]/div[2]/div[2]","opt":"click"},
{"type":"xpath","code":"/html/body/div[2]/c-wiz/div[2]/div[2]/c-wiz[1]/div/div/div[1]/div/div[1]/div","opt":"click"},
{"type":"xpath","code":"/html/body/div[2]/c-wiz/div[2]/div[2]/c-wiz[1]/div/div/div[3]/div/a[2]","opt":"click"},



{"type":"xpath","code":"/html/body/div[2]/c-wiz/div[3]/div[1]/div/div[1]/div/div[1]/div[1]/span/div[1]/div[1]/div[1]/a[1]/div[1]/img","opt":"click"},
{"type":"xpath","code":"/html/body/div[2]/c-wiz/div[3]/div[2]/div[3]/div/div/div[3]/div[2]/c-wiz/div/div[1]/div[1]/div[3]/div/a/img","opt":"get","data":"src"}
{"type":"xpath","code":"/html/body/div[2]/c-wiz/div[3]/div[2]/div[3]/div/div/div[3]/div[2]/c-wiz/div/div[1]/div[1]/div[3]/div/a/img","opt":"get","data":"src","sleep":10}
]
}
}
16 changes: 13 additions & 3 deletions imbot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ def __init__(self,json_data,sleep_time=2,url=""):
self.url=self.json_data['url']
else:
self.url=url

self.driver.get(self.url)
self.sleep_time=sleep_time
#run:
Expand All @@ -50,6 +49,10 @@ def run(self,goto,*argm):
if operation['opt']=="click":
do="click()"
text=f"[✓] Clicking on element_by_{types} : '{code}'"
#
if "sleep" in operation:
sleep(operation['sleep'])
#
exec(f"self.driver.find_element_by_{types}('{code}').{do}")
hexor().c(text,"#299c52")
sleep(self.sleep_time)
Expand All @@ -62,6 +65,10 @@ def run(self,goto,*argm):
data=operation['data']
else:
data=input(hexor(True).c("Data is empty : ","#ff0000"))
#
if "sleep" in operation:
sleep(operation['sleep'])
#
do=f"send_keys('{data}')"
text=f"[✓] Putting data to element_by_{types} : '{code}'"
exec(f"self.driver.find_element_by_{types}('{code}').{do}")
Expand All @@ -78,7 +85,10 @@ def run(self,goto,*argm):
data=operation['data']
else:
data=input(hexor(True).c("Data is empty : ","#ff0000"))
#xxx="hiii"
#
if "sleep" in operation:
sleep(operation['sleep'])
#
xxx=f"self.driver.find_element_by_{types}('{code}').get_attribute('{data}')"
hexor().c(text,"#299c52")
get_list.append(eval(xxx))
Expand Down Expand Up @@ -114,4 +124,4 @@ def about(self):
print(ascii.asciitext(font_url,"#imbot","#ff0000"))
hexor().c("https://github.com/yasserbdj96","#299c52")
print("")
#}END.
#}END.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from setuptools import setup,find_packages
setup(
name="imbot",
version="0.1.3",
version="0.1.6",
author="YasserBDJ96",
author_email="[email protected]",
description='''imbot for making a bot to control any website.''',
Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.3
0.1.6

0 comments on commit 7c97ffc

Please sign in to comment.