Closed yarikoptic closed 2 years ago
I am unable to reproduce the error mentioned in the title; what version of the Python selenium library are you using?
@mvandenburgh (et alii?): The CSS class of the progress bar shown when loading data for a dandiset/:id/draft/files
page seems to have changed. Previously, the webshot script waited for .v-progress-linear
to be invisible, but that no longer suffices for checking whether the files listing has loaded. What check should replace it?
I am unable to reproduce the error mentioned in the title; what version of the Python selenium library are you using?
that screen session is still available on dandi@drogon
happen you need to interactively troubleshoot. The tail of that pip install
in the original message post says selenium-4.1.3
... tripple checking:
dandi@drogon:/mnt/backup/dandi/dandi-api-webshots$ venv/bin/python -c 'import selenium; print(selenium.__version__)'
4.1.3
@mvandenburgh (et alii?): The CSS class of the progress bar shown when loading data for a
dandiset/:id/draft/files
page seems to have changed. Previously, the webshot script waited for.v-progress-linear
to be invisible, but that no longer suffices for checking whether the files listing has loaded. What check should replace it?
.v-progress-linear
should still work as a check. I just double checked on production and the progress bar does indeed have the v-progress-linear
class initially, and then it becomes invisible once the files list has finished loading (see: the search bar in the dev tools under the element inspector) -
@yarikoptic My next best guess is that chromedriver needs to be updated; the current version (in Homebrew, at least) is 99.0.4844.51.
@mvandenburgh Is the progress bar present when the page is initially loaded, or is it only added after?
@yarikoptic My next best guess is that chromedriver needs to be updated; the current version (in Homebrew, at least) is 99.0.4844.51.
Then I think that I better finally upgrade the entire drogon from Debian stretch to bullseye, where it is now shipped as chromium-driver package 99.0.4844.74-1~deb11u1 . But I don't see how driver would relate to that error (AttributeError: 'dict' object has no attribute 'text'
) -- did you check what is in that dict
? may be just a matter of tuning up the script to handle it?
meanwhile I will initiate upgrade through download of packages etc, later will disable cron jobs for the duration of the upgrade, and we might need to redo some or all the venvs
again
@yarikoptic
did you check what is in that
dict
?
No, as I'm not getting a dict
when I run the script locally, and the screen session on drogon you mentioned above seems to be gone now.
it isn't gone. Just login as dandi
, screen -rd
, choose 6th (Ctrl-a 6
). I just reran to exactly the same effect
@yarikoptic The login_button
dict is just {'ELEMENT': '0.136299170337715-1'}
. I don't see a way to make use of that.
@mvandenburgh Is the progress bar present when the page is initially loaded, or is it only added after?
It's added after. (To be specific, it's added after currentDandiset
is initialized)
@mvandenburgh I've tried to detect the presence of .v-progress-linear
with:
WebDriverWait(self.driver, 300).until(
EC.visibility_of_element_located((By.CLASS_NAME, cls))
)
and
WebDriverWait(self.driver, 300).until(
EC.presence_of_element_located((By.CLASS_NAME, cls))
)
before waiting for invisibility, but the waits don't seem to ever finish.
@yarikoptic The
login_button
dict is just{'ELEMENT': '0.136299170337715-1'}
. I don't see a way to make use of that.
but why is that so and how it could be "fixed"?
anyways -- I will upgrade drogon now. May be newer chrome driver would help although IMHO unlikely (ideally we should create a singularity image to avoid relying on system state). I have disabled all cron jobs for now.
@jwodder -- drogon is upgraded, chromedriver is 100.0.4896.60
. Please troubleshoot/fix and reenable cron job (most of the cron jobs are disabled ATM with #UPGRADE
prefix) for webshots.
@yarikoptic The issue in the title is no longer occurring, but the code still needs the changes in #15 in order to work properly again.
ok, should that PR then be merged as is (still in Draft) or further changes needed?
@yarikoptic Depends on whether you can live with the file listings not being snapshotted properly for the time being.
depends on how long the 'time being' would be. I am ok to get some working version to start with but let's have files view fixed asap as well.
@mvandenburgh any hints on how to detect progress bar to disappear? @jwodder - please check how attributes of that object change from the beginning to e.g. 10 seconds after -- might give you a clue on what to wait for in a loop or smth like that.
@mvandenburgh any hints on how to detect progress bar to disappear?
The snippet that @jwodder posted makes sense to me logically, although I'm not familiar enough with selenium to comment on why it would be failing. The only other approach I could think of would be to wait for all background AJAX requests to finish. In our E2E tests we use puppeteer in a similar manner and do this in several tests https://github.com/dandi/dandi-archive/blob/master/web/test/src/util.js#L26-L35, I'm not sure if selenium has similar functionality.
FWIW here is the SO on networkidle* heuristics of puppeteer: https://stackoverflow.com/questions/63366278/selenium-equivalent-of-networkidle2-networkidle0-in-puppeteer
@yarikoptic
please check how attributes of that object change from the beginning to e.g. 10 seconds after
I do not know how to do that. Pretty much all I've been doing is inspecting elements in Chrome, which relies on manually clicking on things after the page appears.
I meant to do something at selenium script level like rich.inspect(whateverwatched)
or some fancier diff on dir(whateverwatched)
in a loop of 10 seconds for e.g. 30 seconds and seeing what changes to make a decision what it is done doing what it was doing.
since I moved
~/cronlib
items under/mnt/backup/dandi/
cron job didn't work for awhile and we are 2 weeks old for https://github.com/dandi/dandi-api-webshots#readme but even that one shows some issues to be addressed "while at it":but I have failed to run it at all (after removing
venv/
so it was recreated):