|
@@ -373,7 +373,30 @@ class CreateAd:
|
|
self.driver.find_element_by_xpath('//*[@id="stage-sidebar"]/section/div[2]/div[5]/div/div').click()
|
|
self.driver.find_element_by_xpath('//*[@id="stage-sidebar"]/section/div[2]/div[5]/div/div').click()
|
|
time.sleep(random.uniform(0.2, 0.3))
|
|
time.sleep(random.uniform(0.2, 0.3))
|
|
input_elements = self.driver.find_elements_by_xpath('//textarea[@class="adui-input-base"]')
|
|
input_elements = self.driver.find_elements_by_xpath('//textarea[@class="adui-input-base"]')
|
|
- pyperclip.copy(config_info['text'])
|
|
|
|
|
|
+ # pyperclip.copy(config_info['text'])
|
|
|
|
+ js_base = '''
|
|
|
|
+ function copyToClipboard(text) {
|
|
|
|
+ var dummy = document.createElement("textarea");
|
|
|
|
+ // to avoid breaking orgain page when copying more words
|
|
|
|
+ // cant copy when adding below this code
|
|
|
|
+ // dummy.style.display = 'none'
|
|
|
|
+ document.body.appendChild(dummy);
|
|
|
|
+ //Be careful if you use texarea. setAttribute('value', value), which works with "input" does not work with "textarea". – Eduard
|
|
|
|
+ dummy.value = text;
|
|
|
|
+ dummy.select();
|
|
|
|
+ document.execCommand("copy");
|
|
|
|
+ document.body.removeChild(dummy);
|
|
|
|
+ }
|
|
|
|
+ '''
|
|
|
|
+ content_change = config_info['text']
|
|
|
|
+
|
|
|
|
+ content_change = content_change.replace("\\", "\\\\")
|
|
|
|
+ content_change = content_change.replace('\n', '\\n')
|
|
|
|
+ content_change = content_change.replace('\n', '\\n')
|
|
|
|
+ content_change = content_change.replace("'", "\'")
|
|
|
|
+
|
|
|
|
+ js_base = js_base + '''copyToClipboard('{}');'''.format(content_change)
|
|
|
|
+ self.driver.execute_script(js_base)
|
|
for _ in input_elements:
|
|
for _ in input_elements:
|
|
if _.is_enabled() and _.is_displayed():
|
|
if _.is_enabled() and _.is_displayed():
|
|
_.send_keys(Keys.CONTROL, 'v')
|
|
_.send_keys(Keys.CONTROL, 'v')
|