Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
rhul-scripts
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Whyte Cameron (2023) ZMAC302
rhul-scripts
Commits
4bcebe76
Commit
4bcebe76
authored
1 year ago
by
Hague Matthew UXAC009
Browse files
Options
Downloads
Patches
Plain Diff
add(moodle): add code for odd firefox in select-users
parent
1b9b5cac
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
moodle/select-users.py
+18
-3
18 additions, 3 deletions
moodle/select-users.py
with
18 additions
and
3 deletions
moodle/select-users.py
+
18
−
3
View file @
4bcebe76
...
...
@@ -7,8 +7,8 @@
# If passed an assignment URL, it searches for the submissions page. If
# passed the user page it uses that directly.
#
# Usage:
#
python3 assignment-select-users.py <mod_code> <ids.csv>
<page-url>
# Usage:
python3 assignment-select-users.py <mod_code> <ids.csv>
# <page-url>
#
# mod_code can be a comma-separated list
#
...
...
@@ -22,6 +22,11 @@
# single click with this script
#
# Looks up ID numbers to email via LDAP
#
# You may want to edit FIREFOX_BINARY below or just a different browser
# instead of webdriver.Firefox. You may also want to externally set the
# environment variable TMPDIR if there's some reason you don't want to
# put a temporary Firefox profile in your normal /tmp (unlikely).
import
browser_cookie3
import
csv
...
...
@@ -36,6 +41,7 @@ from typing import Dict, List, Optional, Set
from
selenium
import
webdriver
from
selenium.webdriver
import
Firefox
from
selenium.webdriver.common.by
import
By
from
selenium.webdriver.firefox.options
import
Options
LDAP_URI
=
'
ldaps://directory.rhul.ac.uk
'
LDAP_BASE
=
'
DC=cc,DC=rhul,DC=local
'
...
...
@@ -50,6 +56,10 @@ WAIT_TIMEOUT = 10 # s
USER_PAGE
=
re
.
compile
(
"
.*/user/index.php.*
"
)
# Leave blank for default binary
FIREFOX_BINARY
=
""
#FIREFOX_BINARY = "org.mozilla.firefox"
class
Browser
:
"""
Simple container of browser setup and teardown
...
...
@@ -60,7 +70,12 @@ class Browser:
self
.
driver
=
None
def
__enter__
(
self
):
self
.
driver
=
webdriver
.
Firefox
()
if
len
(
FIREFOX_BINARY
)
>
0
:
ops
=
Options
()
ops
.
binary_location
=
FIREFOX_BINARY
self
.
driver
=
webdriver
.
Firefox
(
options
=
ops
)
else
:
self
.
driver
=
webdriver
.
Firefox
()
self
.
driver
.
implicitly_wait
(
WAIT_TIMEOUT
)
return
self
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment