# Using selenium By syntax in Julia

**URL:** https://discourse.julialang.org/t/using-selenium-by-syntax-in-julia/87577
**Category:** General Usage
**Created:** [September 21, 2022, 2:31pm UTC](https://discourse.julialang.org/t/using-selenium-by-syntax-in-julia/87577 "2022-09-21T14:31:51Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![rajmac](https://avatars.discourse-cdn.com/v4/letter/r/77aa72/32.png) [@rajmac](https://discourse.julialang.org/u/rajmac)
#### Post date: [September 21, 2022, 2:31pm UTC](https://discourse.julialang.org/t/using-selenium-by-syntax-in-julia/87577/1 "2022-09-21T14:31:51Z")

</div>

Hi, I have been using PyCall and selenium to scrape some sites. Whist I have managed to acheive my ends I have hit a snag which may be due to my being new to Julia. This is that I cannot get the new selenium locator syntax to work on my system. I am using Julia 1.8 with Python 3.10.6 installed via conda and selenium 4.4.0.

Importing By with @pyimport selenium.webdriver.common.By as By works and Julia recognizes By as a module. However if I use driver.find\_element(By.ID, “xyz”) I get an error saying ID not found. This is also the case for all other locator terms such as XPATH. If I search for element xyz with the alternative driver.find\_element(“id”, “xyz”) syntax then the element is found. However this syntax limits the number of terms allowed for element location compared to the By module. If I write the script in Python then the By syntax works perfectly using the same versions of Python and selenium.

Am I making some mistake in the import of the selenium module, or its use under PyCall, and if so how should this be done?

In the hope of enlightenment.
