text stringlengths 0 59.1k |
|---|
```python |
from selenium import webdriver |
def check_browser(browser): |
if browser == "CHROME": |
options = webdriver.ChromeOptions() |
elif browser == "FIREFOX": |
options = webdriver.FirefoxOptions() |
driver = webdriver.Remote( |
command_executor='http://selenium-hub:4444/wd/hub', |
options=options |
) |
driver.get("http://www.google.com") |
assert "google" in driver.page_source |
driver.quit() |
print("Browser %s checks out!" % browser) |
check_browser("FIREFOX") |
check_browser("CHROME") |
``` |
You should get |
``` |
>>> check_browser("FIREFOX") |
Browser FIREFOX checks out! |
>>> check_browser("CHROME") |
Browser CHROME checks out! |
``` |
Congratulations, your Selenium Hub is up, with Firefox and Chrome nodes! |
### Scale your Firefox and Chrome nodes. |
If you need more Firefox or Chrome nodes, your hardware is the limit: |
```console |
kubectl scale deployment selenium-node-firefox --replicas=10 |
kubectl scale deployment selenium-node-chrome --replicas=10 |
``` |
You now have 10 Firefox and 10 Chrome nodes, happy Seleniuming! |
### Debugging |
Sometimes it is necessary to check on a hung test. Each pod is running VNC. To check on one of the browser nodes via VNC, it's recommended that you proxy, since we don't want to expose a service for every pod, and the containers have a weak VNC password. Replace POD_NAME with the name of the pod you want to connect to. |
```console |
kubectl port-forward $POD_NAME 5900:5900 |
``` |
Then connect to localhost:5900 with your VNC client using the password "secret" |
Enjoy your scalable Selenium Grid! |
Adapted from: https://github.com/SeleniumHQ/docker-selenium |
### Teardown |
To remove all created resources, run the following: |
```console |
kubectl delete deployment selenium-hub |
kubectl delete deployment selenium-node-chrome |
kubectl delete deployment selenium-node-firefox |
kubectl delete deployment selenium-python |
kubectl delete svc selenium-hub |
``` |
<|endoftext|> |
# source: k8s_docs/code-of-conduct.md type: docs |
# Kubernetes Community Code of Conduct |
Please refer to our [Kubernetes Community Code of Conduct](https://git.k8s.io/community/code-of-conduct.md) |
<|endoftext|> |
# source: k8s_docs/cloudbuild.yaml type: yaml |
# See https://cloud.google.com/cloud-build/docs/build-config |
# this must be specified in seconds. If omitted, defaults to 600s (10 mins) |
timeout: 9000s |
# this prevents errors if you don't use both _GIT_TAG and _PULL_BASE_REF, |
# or any new substitutions added in the future. |
options: |
substitution_option: ALLOW_LOOSE |
machineType: 'E2_HIGHCPU_8' |
steps: |
# It's fine to bump the tag to a recent version, as needed |
- name: "gcr.io/k8s-staging-test-infra/gcb-docker-gcloud:v20220830-45cbff55bc" |
entrypoint: 'bash' |
env: |
- DOCKER_CLI_EXPERIMENTAL=enabled |
- DOCKER_BUILDKIT=1 |
- DOCKER_BUILDX=/root/.docker/cli-plugins/docker-buildx |
- TAG=$_GIT_TAG |
- BASE_REF=$_PULL_BASE_REF |
args: |
- -c |
- | |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.