I want to copy and paste clipboard link to newly opened browser tab. The fresh tab is opening but nothing is happening. Clip method in result have this url link but I got error.
What I have till now :
def switch_tab(self):
self.driver.execute_script("window.open('');")
self.driver.switch_to.window(self.driver.window_handles[len(self.driver.window_handles) - 1])
time.sleep(2)
self.driver.get(clip)
and clip method
def clip():
r = Tk()
r.withdraw()
while not r.selection_get(selection="CLIPBOARD"):
time.sleep(0.1)
result = r.selection_get(selection="CLIPBOARD")
print(result)
return result
File "C:UsersAppDataLocalProgramsPythonPython38libjsonencoder.py", line 179, in default
raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type function is not JSON serializable
question from:
https://stackoverflow.com/questions/65871462/pasting-link-from-clipboard-to-next-window-as-a-url 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…