Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
python_open_ai
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
haojie
python_open_ai
Commits
1be0b88e
Commit
1be0b88e
authored
Apr 14, 2023
by
wangfa
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
79ebf1e9
294f883a
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
11 deletions
+6
-11
Helper.py
+0
-0
gpt.py
+1
-1
test.py
+5
-10
No files found.
Helper.py
View file @
1be0b88e
This diff is collapsed.
Click to expand it.
gpt.py
View file @
1be0b88e
...
@@ -7,7 +7,7 @@ import requests
...
@@ -7,7 +7,7 @@ import requests
import
re
import
re
import
openai
import
openai
from
loguru
import
logger
from
loguru
import
logger
from
Helper
import
RedisCon
,
Helper
from
Helper
import
RedisCon
# key
# key
api_key
=
'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'
api_key
=
'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'
...
...
test.py
View file @
1be0b88e
...
@@ -70,24 +70,19 @@ async def main():
...
@@ -70,24 +70,19 @@ async def main():
page
=
cur_pages
[
0
]
page
=
cur_pages
[
0
]
await
page
.
goto
(
'https://discord.com/channels/@me'
)
await
page
.
goto
(
'https://discord.com/channels/@me'
)
await
login
(
page
)
await
login
(
page
)
time
.
sleep
(
20
)
# 测试文字
# 测试文字
test_title
=
'你好你好你好222'
test_title
=
'你好你好你好222'
# 插入文本
# 插入文本
input_path
=
'//*[@id="app-mount"]/div[2]/div[1]/div[1]/div/div[2]/div/div/div/div/div[2]/div/main/form/div/div[2]/div/div[2]/div/div/div/span[2]/span[2]/span/span/span'
input_path
=
'//*[@id="app-mount"]/div[2]/div[1]/div[1]/div/div[2]/div/div/div/div/div[2]/div/main/form/div/div[2]/div/div[2]/div/div/div/span[2]/span[2]/span/span/span'
element
=
await
FindElement
(
page
,
input_path
)
element
=
await
FindElement
(
page
,
input_path
)
# var evt = new InputEvent('input', {
# inputType: 'insertText',
# data: st,
# dataTransfer: null,
# isComposing: false
# });
# dom.dispatchEvent(evt);
if
element
:
if
element
:
await
page
.
evaluate
(
'''(element,test_title) => {
await
page
.
evaluate
(
'''(element,test_title) => {
element.innerHTML = test_title
element.innerHTML = test_title
var dom = document.querySelector('body')
const ke = new KeyboardEvent('keydown', {
console.log(dom)
bubbles: true, cancelable: true, keyCode: 49
dom.value = test_title
});
document.body.dispatchEvent(ke);
}'''
,
element
,
test_title
)
}'''
,
element
,
test_title
)
logger
.
info
(
'成功'
)
logger
.
info
(
'成功'
)
# 回车
# 回车
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment