Djaenk / zyBooks-Activity-Completer

Python 3 script which automatically completes assigments on the zyBooks platform.
MIT License
18 stars 14 forks source link

Script error #6

Closed JimBoehme closed 3 years ago

JimBoehme commented 4 years ago

Starting chapter 5 section 34... Completed animation activity Completed multiple choice set Completed multiple choice set Completed short answer set Completed short answer set

Starting chapter 5 section 35... Completed animation activity Completed multiple choice set Traceback (most recent call last): File "complete.py", line 289, in sectionSelection(driver, chapter) File "complete.py", line 108, in sectionSelection completeParticipationActivities(driver) File "complete.py", line 119, in completeParticipationActivities completeMultipleChoice(driver) File "complete.py", line 161, in completeMultipleChoice driver.find_element_by_xpath("//div[@class='section-header-row']").click() File "C:\Users\Jim\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\remote\webelement.py", line 80, in click self._execute(Command.CLICK_ELEMENT) File "C:\Users\Jim\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\remote\webelement.py", line 633, in _execute return self._parent.execute(command, params) File "C:\Users\Jim\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute self.error_handler.check_response(response) File "C:\Users\Jim\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.ElementClickInterceptedException: Message: Element

is not clickable at point (633,19) because another element
obscures it

C:\Users\Jim\Desktop\zyBooks-Activity-Completer-master>

Djaenk commented 4 years ago

Sorry I haven't responded, I don't keep an eye on this repo anymore. If this issue still exists and needs a fix, I can look into it. I'll need the page source for chapter 5 section 35 of the zybook you're running this on.

JimBoehme commented 4 years ago

Thanks for the reply.  I've actually worked through the issue, and also solved the matching issue you documented (by using Javascript which is the only way to get drag/drop to work - Selenium won't do that).  I did convert your work to C# only because I am more familiar with that language than Python.  If you want my JavaScript, you are welcome to it. On Sunday, July 12, 2020, 05:50:14 PM PDT, Djaenk notifications@github.com wrote:

Sorry I haven't responded, I don't keep an eye on this repo anymore. If this issue still exists and needs a fix, I can look into it. I'll need the page source for chapter 5 section 35 of the zybook you're running this on.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

Djaenk commented 4 years ago

I'd like to get a hold of the js you used to fix the problem, if you could link or paste it.

JimBoehme commented 4 years ago

function customEvent(typeOfEvent) {    var event = document.createEvent("CustomEvent");    event.initCustomEvent(typeOfEvent, true, true, null);    event.dataTransfer = {        data: {},        setData: function (key, value) {            this.data[key] = value;        },        getData: function (key) {            return this.data[key];        }    };    return event;}function dispatchEvent(element, event, transferData) {    if (transferData !== undefined) {        event.dataTransfer = transferData;    }    if (element.dispatchEvent) {        element.dispatchEvent(event);    } else if (element.fireEvent) {        element.fireEvent("on" + event.type, event);    }}function executeDrageAndDrop(element, target) {    var dragStartEvent = customEvent('dragstart');    dispatchEvent(element, dragStartEvent);    var dropEvent = customEvent('drop');    dispatchEvent(target, dropEvent, dragStartEvent.dataTransfer);    var dragEndEvent = customEvent('dragend');    dispatchEvent(element, dragEndEvent, dropEvent.dataTransfer);}

string script = System.IO.File.ReadAllText(@"....\DragDrop.js");script = script + "executeDrageAndDrop(arguments[0], arguments[1])";            IJavaScriptExecutor executor = (IJavaScriptExecutor)driver; executor.ExecuteScript(script, choice, empty_bucket);

On Saturday, July 18, 2020, 02:08:33 PM PDT, Djaenk <notifications@github.com> wrote:  

I'd like to get a hold of the js you used to fix the problem, if you could link or paste it.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

Jaksuhn commented 3 years ago

Was this fixed? Same issue (Element <div class="section-header-row"> is not clickable) with the result of #9

Starting chapter x section xx. . . 
Headless firefox browser closed