I have this code to run a simple automated test :
class AddToCartTest(unittest.TestCase):
direct = os.getcwd()
def setUp(self):
if os.getenv('CHROMEWEBDRIVER'):
chromewebdriverbin = os.getenv('CHROMEWEBDRIVER')
else:
chromewebdriverbin = '/usr/local/bin/chromedriver'
self.driver = webdriver.Chrome(executable_path=chromewebdriverbin)
def test_add_to_cart_with_login(self):
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--no-sandbox')
chrome_options.add_argument("--headless")
chrome_options.add_argument("--disable-gpu")
chrome_options.add_argument("--window-size=1920,1080")
browser = webdriver.Chrome(options=chrome_options)
browser.get('https://www.google.com')
time.sleep(5)
browser.quit()
if __name__ == '__main__':
unittest.main()
i have this config on Jenkins shell on my kenkins cloud :
export https_proxy=http://proxy.org:3128
export http_proxy=http://proxy.org:3128
And i import venv python3 -m venv venv source ./venv/bin/activate I install PIP and Selenium and Allure report
pip3 install --upgrade pip
pip3 install selenium
pip3 install allure-pytest
pip3 install -r requirements.txt
echo "Import chromedriver on the env variable."
export CHROMEWEBDRIVER=/usr/local/bin/chromedriver
echo "Import python path on the env variable."
export PYTHONPATH=.
python3 com/POMProject/Tests/Cart/test.py
CodePudding user response:
I have solve it by updating chromedriver on jenkins who used old version