I'm trying to create a test case for Tumblr (currently in the process of learning automation) and I'm stuck on trying to access the drafts page. So here's what's happening - after I post an image as draft and try to access "Drafts" and delete them, below is the error I'm getting:
Traceback (most recent call last):
File "C:\Users\eclipse-workspace\Pytest\python1\PySel.py",
line 93, in <module>
driver.find_element_by_id('account_button').click()
File "C:\Users\AppData\Local\Programs\Python\Python36-
32\lib\site-packages\selenium\webdriver\remote\webelement.py", line 80, in
click self._execute(Command.CLICK_ELEMENT)
File "C:\Users\AppData\Local\Programs\Python\Python36-
32\lib\site-packages\selenium\webdriver\remote\webelement.py", line 501, in
_execute return self._parent.execute(command, params)
File "C:\Users\AppData\Local\Programs\Python\Python36-
32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 308, in
execute self.error_handler.check_response(response)
File "C:\Users\AppData\Local\Programs\Python\Python36-
32\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 194,
in check_response raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error:
Element <div class="tab iconic tab_nav_account " id="account_button">...
</div> is not clickable at point (924, 28). Other element would receive the
click: <div class="v-center-inner">...</div>
(Session info: chrome=62.0.3202.94)
(Driver info: chromedriver=2.33.506120
(e3e53437346286c0bc2d2dc9aa4915ba81d9023f),platform=Windows NT 6.1.7601 SP1
x86_64)
I've tried page refresh -which causes a prompt if I want to terminate the post which I find weird as to why it does not wait to post first before it refreshes itself (see attached image)
and implicit wait but that doesn't seem to do anything. The code driver.find_element_by_id('account_button').click()
works just fine at the beginning but suddenly won't run after posting draft. I think this has something to do with switching window maybe? Another thing is how do I locate the window name for the posting section?
This is my complete code:
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait as wait
import os
user = ""
pwd = ""
driver = webdriver.Chrome()
driver.get("https://www.tumblr.com/login")
assert "Tumblr" in driver.title
elem = driver.find_element_by_id("signup_determine_email")
elem.send_keys("email")
elem.send_keys(Keys.RETURN)
driver.implicitly_wait(10)
elem = driver.find_element_by_id("signup_password")
elem.send_keys("password")
elem.send_keys(Keys.RETURN)
driver.find_element_by_id('account_button').click()
driver.find_element_by_xpath("//a[@href='/settings']").click()
assert "Account" in driver.title
driver.implicitly_wait(10)
driver.back()
driver.find_element_by_class_name('compose-button').click()
driver.find_element_by_xpath("//div[@class='post-type-icon icon-text']").click()
driver.implicitly_wait(15)
driver.find_element_by_css_selector(".post-form--save-button .dropdown-area").click()
driver.implicitly_wait(15)
driver.find_element_by_xpath("//div[@class='editor editor-richtext']").click()
driver.implicitly_wait(15)
driver.find_element_by_xpath("//div[@class='editor editor-plaintext']").send_keys("This is a Test Title")<br>
driver.implicitly_wait(15)
driver.find_element_by_xpath("//div[@class='editor editor-richtext']").click()
driver.implicitly_wait(60)
driver.find_element_by_xpath("//div[@class='control add-image']").click()
os.system(r'"C:/Users/pmevangelista/Desktop/AutoIt/FileUpload.exe"')<br>
driver.find_element_by_xpath("//div[@class='editor editor-richtext']").send_keys("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.")
driver.implicitly_wait(60)
driver.find_element_by_css_selector(".post-form--save-button .button-area").click()
driver.refresh()
driver.find_element_by_id('account_button').click()<br>