Cov txheej txheem:

Kuv yuav luag thiab xa cov ntaub ntawv hauv selenium li cas?
Kuv yuav luag thiab xa cov ntaub ntawv hauv selenium li cas?

Video: Kuv yuav luag thiab xa cov ntaub ntawv hauv selenium li cas?

Video: Kuv yuav luag thiab xa cov ntaub ntawv hauv selenium li cas?
Video: Qhia txog cov lus สะภาน ทูด meka yuav nug koj ,thaum lawv hu koj xam phaj koj yuav tsum ua li ca? 2024, Kaum ib hlis
Anonim

Yog nws ua tau poob a ntaub ntawv nrog Selenium ntawm kev txhaj tshuaj script. Tsab ntawv yuav tsum tau tsim ib lub vev xaib kom tau txais qhov ntaub ntawv xa los ntawm SendKeys. Tom qab ntawd simulate tus dragenter, dragover thiab poob xwm txheej ntawm lub hom phiaj lub caij nrog rau ntaub ntawv teem rau hauv cov khoom siv dataTransfer.

Ib yam li ntawd, kuv yuav luag thiab poob rau hauv selenium li cas?

Drag And Drop Siv Chav Ua Haujlwm:

  1. WebElement sourceLocator = tus tsav tsheb. findElement(By. xpath("xpath"));
  2. WebElement targetLocator = tus tsav tsheb. findElement(By. xpath("xpath"));
  3. Action action = new Actions(driver);
  4. kev ua. dragAndDrop(sourceLocator, targetLocator). tsim (). ua();

Ib yam li ntawd, koj yuav luag thiab poob hauv Appium li cas? Cia peb ua piv txwv yooj yim heev rau ua luag thiab poob kev ua haujlwm ntawm hauv daim ntawv thov siv appium.

Khiav saum toj no xeem siv testng thiab saib Drag And Drop nyob rau hauv koj lub mobile ntaus ntawv.

  1. Nws yuav tso Drag-Sort Demos app.
  2. Coj mus rhaub rau "Basic use playground" ntawv thiab.
  3. Ua draga thiab poob haujlwm raws li qhia hauv cov duab saum toj no.

Ib yam li ntawd, koj tuaj yeem nug, koj yuav siv selenium li cas los xa cov ntaub ntawv?

Uploading ntaub ntawv hauv WebDriver yog ua los ntawm yooj yim siv sendKeys() txoj kev ntawm lub ntaub ntawv -xaiv input teb nkag mus rau txoj kev mus rau lub ntaub ntawv ua uploaded.

Siv WebDriver thiab Wget

  1. Import lub "java.
  2. Siv getAttribute() kom tau txais "href" tus nqi ntawm qhov txuas rub tawm thiab txuag nws ua ib txoj hlua sib txawv.

Yuav ua li cas koj swb hauv selenium?

Slide-bar thiab swb ua haujlwm siv Webdriver

  1. Qhib URL ntawm selenium code.
  2. Hloov mus rau lub thawv ntim kom ncav cuag lub slider thiab slider bar web keeb.
  3. Xaiv lub bar thiab tau txais qhov dav.
  4. Tam sim no peb yuav tsum tau txav mus rau 50% (231px) lossis 100px.
  5. Tau txais lub vev xaib rau lub slider ntawm lub bar.
  6. Tam sim no peb xav txav lub slider ntawm sab xis horizontally txhais tau tias ntawm Y axis.

Pom zoo: